summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Garnaat <mitch@garnaat.com>2012-03-28 11:49:05 -0700
committerMitch Garnaat <mitch@garnaat.com>2012-03-28 11:49:05 -0700
commitb4083978da43118274ff3c65dda2d085e30fc5ab (patch)
tree6662f321fdf486c1bd21990cea33e1d269854f17
parentee94b00f9bff5f25e7a2b51a53c5e26322514ba7 (diff)
downloadboto-b4083978da43118274ff3c65dda2d085e30fc5ab.tar.gz
PEP8 cleanup.
-rw-r--r--boto/route53/__init__.py2
-rw-r--r--boto/route53/connection.py37
-rw-r--r--boto/route53/exception.py3
-rw-r--r--boto/route53/hostedzone.py2
-rw-r--r--boto/route53/record.py14
-rw-r--r--boto/sdb/__init__.py9
-rw-r--r--boto/sdb/connection.py159
-rw-r--r--boto/sdb/domain.py112
-rw-r--r--boto/sdb/item.py43
-rw-r--r--boto/sdb/queryresultset.py13
-rw-r--r--boto/sdb/regioninfo.py3
-rw-r--r--boto/ses/__init__.py9
-rw-r--r--boto/ses/connection.py16
-rw-r--r--boto/ses/exceptions.py3
-rw-r--r--boto/sns/__init__.py9
-rw-r--r--boto/sns/connection.py105
-rw-r--r--boto/sqs/__init__.py6
-rw-r--r--boto/sqs/attributes.py7
-rw-r--r--boto/sqs/batchresults.py10
-rw-r--r--boto/sqs/connection.py69
-rw-r--r--boto/sqs/jsonmessage.py6
-rw-r--r--boto/sqs/message.py96
-rw-r--r--boto/sqs/queue.py80
-rw-r--r--boto/sqs/regioninfo.py3
-rw-r--r--boto/sts/__init__.py9
-rw-r--r--boto/sts/connection.py11
-rw-r--r--boto/sts/credentials.py6
-rw-r--r--boto/swf/__init__.py7
-rw-r--r--boto/swf/layer1.py43
-rw-r--r--boto/vpc/__init__.py166
-rw-r--r--boto/vpc/customergateway.py6
-rw-r--r--boto/vpc/dhcpoptions.py12
-rw-r--r--boto/vpc/internetgateway.py5
-rw-r--r--boto/vpc/routetable.py3
-rw-r--r--boto/vpc/subnet.py2
-rw-r--r--boto/vpc/vpc.py6
-rw-r--r--boto/vpc/vpnconnection.py6
-rw-r--r--boto/vpc/vpngateway.py11
38 files changed, 607 insertions, 502 deletions
diff --git a/boto/route53/__init__.py b/boto/route53/__init__.py
index 7f753e19..75648c42 100644
--- a/boto/route53/__init__.py
+++ b/boto/route53/__init__.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
diff --git a/boto/route53/connection.py b/boto/route53/connection.py
index b0bb0775..390c89ff 100644
--- a/boto/route53/connection.py
+++ b/boto/route53/connection.py
@@ -15,23 +15,20 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
import xml.sax
-import time
import uuid
import boto
from boto.connection import AWSAuthConnection
from boto import handler
-from boto.resultset import ResultSet
import boto.jsonresponse
import boto.compat as compat
from . import exception
-from . import hostedzone
HZXML = """<?xml version="1.0" encoding="UTF-8"?>
<CreateHostedZoneRequest xmlns="%(xmlns)s">
@@ -41,9 +38,10 @@ HZXML = """<?xml version="1.0" encoding="UTF-8"?>
<Comment>%(comment)s</Comment>
</HostedZoneConfig>
</CreateHostedZoneRequest>"""
-
+
#boto.set_stream_logger('dns')
+
class Route53Connection(AWSAuthConnection):
DefaultHost = 'route53.amazonaws.com'
"""The default Route53 API endpoint to connect to."""
@@ -68,10 +66,12 @@ class Route53Connection(AWSAuthConnection):
if params:
pairs = []
for key, val in params.items():
- if val is None: continue
+ if val is None:
+ continue
pairs.append(key + '=' + compat.quote(str(val)))
path += '?' + '&'.join(pairs)
- return AWSAuthConnection.make_request(self, action, path, headers, data)
+ return AWSAuthConnection.make_request(self, action, path,
+ headers, data)
# Hosted Zones
@@ -110,10 +110,9 @@ class Route53Connection(AWSAuthConnection):
def get_hosted_zone(self, hosted_zone_id):
"""
Get detailed information about a particular Hosted Zone.
-
+
:type hosted_zone_id: str
:param hosted_zone_id: The unique identifier for the Hosted Zone
-
"""
uri = '/%s/hostedzone/%s' % (self.Version, hosted_zone_id)
response = self.make_request('GET', uri)
@@ -133,7 +132,7 @@ class Route53Connection(AWSAuthConnection):
"""
Create a new Hosted Zone. Returns a Python data structure with
information about the newly created Hosted Zone.
-
+
:type domain_name: str
:param domain_name: The name of the domain. This should be a
fully-specified domain, and should end with a final period
@@ -153,20 +152,20 @@ class Route53Connection(AWSAuthConnection):
use that.
:type comment: str
- :param comment: Any comments you want to include about the hosted
+ :param comment: Any comments you want to include about the hosted
zone.
"""
if caller_ref is None:
caller_ref = str(uuid.uuid4())
- params = {'name' : domain_name,
- 'caller_ref' : caller_ref,
- 'comment' : comment,
- 'xmlns' : self.XMLNameSpace}
+ params = {'name': domain_name,
+ 'caller_ref': caller_ref,
+ 'comment': comment,
+ 'xmlns': self.XMLNameSpace}
xml = HZXML % params
uri = '/%s/hostedzone' % self.Version
response = self.make_request('POST', uri,
- {'Content-Type' : 'text/xml'}, xml)
+ {'Content-Type': 'text/xml'}, xml)
body = response.read()
boto.log.debug(body)
if response.status == 201:
@@ -179,7 +178,7 @@ class Route53Connection(AWSAuthConnection):
raise exception.DNSServerError(response.status,
response.reason,
body)
-
+
def delete_hosted_zone(self, hosted_zone_id):
uri = '/%s/hostedzone/%s' % (self.Version, hosted_zone_id)
response = self.make_request('DELETE', uri)
@@ -201,7 +200,7 @@ class Route53Connection(AWSAuthConnection):
"""
Retrieve the Resource Record Sets defined for this Hosted Zone.
Returns the raw XML data returned by the Route53 call.
-
+
:type hosted_zone_id: str
:param hosted_zone_id: The unique identifier for the Hosted Zone
@@ -281,7 +280,7 @@ class Route53Connection(AWSAuthConnection):
"""
uri = '/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)
response = self.make_request('POST', uri,
- {'Content-Type' : 'text/xml'},
+ {'Content-Type': 'text/xml'},
xml_body)
body = response.read()
boto.log.debug(body)
diff --git a/boto/route53/exception.py b/boto/route53/exception.py
index ba41285a..4ede7c20 100644
--- a/boto/route53/exception.py
+++ b/boto/route53/exception.py
@@ -15,13 +15,14 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from boto.exception import BotoServerError
+
class DNSServerError(BotoServerError):
pass
diff --git a/boto/route53/hostedzone.py b/boto/route53/hostedzone.py
index 66b79b84..fd8420c4 100644
--- a/boto/route53/hostedzone.py
+++ b/boto/route53/hostedzone.py
@@ -22,6 +22,7 @@
# IN THE SOFTWARE.
#
+
class HostedZone(object):
def __init__(self, id=None, name=None, owner=None, version=None,
@@ -53,4 +54,3 @@ class HostedZone(object):
self.caller_reference = value
else:
setattr(self, name, value)
-
diff --git a/boto/route53/record.py b/boto/route53/record.py
index d4fca362..bbd7fcd3 100644
--- a/boto/route53/record.py
+++ b/boto/route53/record.py
@@ -23,6 +23,8 @@
RECORD_TYPES = ['A', 'AAAA', 'TXT', 'CNAME', 'MX', 'PTR', 'SRV', 'SPF']
from boto.resultset import ResultSet
+
+
class ResourceRecordSets(ResultSet):
"""
A list of resource records.
@@ -159,7 +161,6 @@ class ResourceRecordSets(ResultSet):
results = None
-
class Record(object):
"""An individual ResourceRecordSet"""
@@ -195,8 +196,6 @@ class Record(object):
<DNSName>%s</DNSName>
</AliasTarget>"""
-
-
def __init__(self, name=None, type=None, ttl=600, resource_records=None,
alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
weight=None, region=None):
@@ -225,7 +224,8 @@ class Record(object):
"""Spit this resource record set out as XML"""
if self.alias_hosted_zone_id != None and self.alias_dns_name != None:
# Use alias
- body = self.AliasBody % (self.alias_hosted_zone_id, self.alias_dns_name)
+ body = self.AliasBody % (self.alias_hosted_zone_id,
+ self.alias_dns_name)
else:
# Use resource record(s)
records = ""
@@ -241,8 +241,8 @@ class Record(object):
self.weight}
elif self.identifier != None and self.region != None:
weight = self.RRRBody % {"identifier": self.identifier, "region":
- self.region}
-
+ self.region}
+
params = {
"name": self.name,
"type": self.type,
@@ -258,7 +258,7 @@ class Record(object):
rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name
else:
# Show resource record(s)
- rr = ",".join(self.resource_records)
+ rr = ",".join(self.resource_records)
if self.identifier != None and self.weight != None:
rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)
diff --git a/boto/sdb/__init__.py b/boto/sdb/__init__.py
index a6326b3d..81c99f6b 100644
--- a/boto/sdb/__init__.py
+++ b/boto/sdb/__init__.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -22,6 +22,7 @@
from .regioninfo import SDBRegionInfo
+
def regions():
"""
Get all available regions for the SDB service.
@@ -45,14 +46,15 @@ def regions():
endpoint='sdb.ap-southeast-1.amazonaws.com')
]
+
def connect_to_region(region_name, **kw_params):
"""
- Given a valid region name, return a
+ Given a valid region name, return a
:class:`boto.sdb.connection.SDBConnection`.
:type: str
:param region_name: The name of the region to connect to.
-
+
:rtype: :class:`boto.sdb.connection.SDBConnection` or ``None``
:return: A connection to the given region, or None if an invalid region
name is given
@@ -62,6 +64,7 @@ def connect_to_region(region_name, **kw_params):
return region.connect(**kw_params)
return None
+
def get_region(region_name, **kw_params):
"""
Find and return a :class:`boto.sdb.regioninfo.RegionInfo` object
diff --git a/boto/sdb/connection.py b/boto/sdb/connection.py
index 367e901c..b8a00ab9 100644
--- a/boto/sdb/connection.py
+++ b/boto/sdb/connection.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -26,26 +26,31 @@ from boto import handler
from boto.connection import AWSQueryConnection
from boto.sdb.domain import Domain, DomainMetaData
from boto.sdb.item import Item
-from boto.sdb.regioninfo import SDBRegionInfo
from boto.exception import SDBResponseError
+
class ItemThread(threading.Thread):
"""
- A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class.
+ A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class.
Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the
``items`` instance variable after :py:meth:`run() <run>` is called.
-
+
.. tip:: The item retrieval will not start until
- the :func:`run() <boto.sdb.connection.ItemThread.run>` method is called.
+ the :func:`run() <boto.sdb.connection.ItemThread.run>` method
+ is called.
"""
+
def __init__(self, name, domain_name, item_names):
"""
:param str name: A thread name. Used for identification.
- :param str domain_name: The name of a SimpleDB
+
+ :param str domain_name: The name of a SimpleDB
:class:`Domain <boto.sdb.domain.Domain>`
+
:type item_names: string or list of strings
- :param item_names: The name(s) of the items to retrieve from the specified
- :class:`Domain <boto.sdb.domain.Domain>`.
+ :param item_names: The name(s) of the items to retrieve from
+ the specified :class:`Domain <boto.sdb.domain.Domain>`.
+
:ivar list items: A list of items retrieved. Starts as empty list.
"""
threading.Thread.__init__(self, name=name)
@@ -56,7 +61,7 @@ class ItemThread(threading.Thread):
def run(self):
"""
- Start the threaded retrieval of items. Populates the
+ Start the threaded retrieval of items. Populates the
``items`` list with :class:`Item <boto.sdb.item.Item>` objects.
"""
for item_name in self.item_names:
@@ -65,13 +70,14 @@ class ItemThread(threading.Thread):
#boto.set_stream_logger('sdb')
+
class SDBConnection(AWSQueryConnection):
"""
This class serves as a gateway to your SimpleDB region (defaults to
- us-east-1). Methods within allow access to SimpleDB
+ us-east-1). Methods within allow access to SimpleDB
:class:`Domain <boto.sdb.domain.Domain>` objects and their associated
:class:`Item <boto.sdb.item.Item>` objects.
-
+
.. tip::
While you may instantiate this class directly, it may be easier to
go through :py:func:`boto.connect_sdb`.
@@ -91,19 +97,20 @@ class SDBConnection(AWSQueryConnection):
:py:class:`boto.connection.AWSAuthConnection`. You can avoid having
to worry about these keyword arguments by instantiating these objects
via :py:func:`boto.connect_sdb`.
-
+
:type region: :class:`boto.sdb.regioninfo.SDBRegionInfo`
- :keyword region: Explicitly specify a region. Defaults to ``us-east-1``
- if not specified. You may also specify the region in your ``boto.cfg``:
+ :keyword region: Explicitly specify a region.
+ Defaults to ``us-east-1`` if not specified. You may also
+ specify the region in your ``boto.cfg``:
.. code-block:: cfg
[SDB]
region = eu-west-1
-
"""
if not region:
- region_name = boto.config.get('SDB', 'region', self.DefaultRegionName)
+ region_name = boto.config.get('SDB', 'region',
+ self.DefaultRegionName)
for reg in boto.sdb.regions():
if reg.name == region_name:
region = reg
@@ -129,7 +136,7 @@ class SDBConnection(AWSQueryConnection):
While the default item class is :py:class:`boto.sdb.item.Item`, this
default may be overridden. Use this method to change a connection's
item class.
-
+
:param object cls: The new class to set as this connection's item
class. See the default item class for inspiration as to what your
replacement should/could look like.
@@ -208,8 +215,8 @@ class SDBConnection(AWSQueryConnection):
def get_usage(self):
"""
- Returns the BoxUsage (in USD) accumulated on this specific SDBConnection
- instance.
+ Returns the BoxUsage (in USD) accumulated on this specific
+ SDBConnection instance.
.. tip:: This can be out of date, and should only be treated as a
rough estimate. Also note that this estimate only applies to the
@@ -217,7 +224,8 @@ class SDBConnection(AWSQueryConnection):
no means an account-wide estimate.
:rtype: float
- :return: The accumulated BoxUsage of all requests made on the connection.
+ :return: The accumulated BoxUsage of all requests made on the
+ connection.
"""
return self.box_usage
@@ -225,7 +233,7 @@ class SDBConnection(AWSQueryConnection):
"""
Print the BoxUsage and approximate costs of all requests made on
this specific SDBConnection instance.
-
+
.. tip:: This can be out of date, and should only be treated as a
rough estimate. Also note that this estimate only applies to the
requests made on this specific connection instance. It is by
@@ -239,14 +247,14 @@ class SDBConnection(AWSQueryConnection):
"""
Retrieves a :py:class:`boto.sdb.domain.Domain` object whose name
matches ``domain_name``.
-
+
:param str domain_name: The name of the domain to retrieve
:keyword bool validate: When ``True``, check to see if the domain
actually exists. If ``False``, blindly return a
- :py:class:`Domain <boto.sdb.domain.Domain>` object with the
+ :py:class:`Domain <boto.sdb.domain.Domain>` object with the
specified name set.
- :raises:
+ :raises:
:py:class:`boto.exception.SDBResponseError` if ``validate`` is
``True`` and no match could be found.
@@ -260,12 +268,12 @@ class SDBConnection(AWSQueryConnection):
def lookup(self, domain_name, validate=True):
"""
- Lookup an existing SimpleDB domain. This differs from
+ Lookup an existing SimpleDB domain. This differs from
:py:meth:`get_domain` in that ``None`` is returned if ``validate`` is
``True`` and no match was found (instead of raising an exception).
:param str domain_name: The name of the domain to retrieve
-
+
:param bool validate: If ``True``, a ``None`` value will be returned
if the specified domain can't be found. If ``False``, a
:py:class:`Domain <boto.sdb.domain.Domain>` object will be dumbly
@@ -285,8 +293,8 @@ class SDBConnection(AWSQueryConnection):
Returns a :py:class:`boto.resultset.ResultSet` containing
all :py:class:`boto.sdb.domain.Domain` objects associated with
this connection's Access Key ID.
-
- :keyword int max_domains: Limit the returned
+
+ :keyword int max_domains: Limit the returned
:py:class:`ResultSet <boto.resultset.ResultSet>` to the specified
number of members.
:keyword str next_token: A token string that was returned in an
@@ -314,7 +322,7 @@ class SDBConnection(AWSQueryConnection):
:rtype: :class:`boto.sdb.domain.Domain` object
:return: The newly created domain
"""
- params = {'DomainName':domain_name}
+ params = {'DomainName': domain_name}
d = self.get_object('CreateDomain', params, Domain)
d.name = domain_name
return d
@@ -323,18 +331,18 @@ class SDBConnection(AWSQueryConnection):
"""
Given a ``str`` or :class:`boto.sdb.domain.Domain`, return a
``tuple`` with the following members (in order):
-
+
* In instance of :class:`boto.sdb.domain.Domain` for the requested
domain
* The domain's name as a ``str``
-
+
:type domain_or_name: ``str`` or :class:`boto.sdb.domain.Domain`
:param domain_or_name: The domain or domain name to get the domain
and name for.
-
+
:raises: :class:`boto.exception.SDBResponseError` when an invalid
domain name is specified.
-
+
:rtype: tuple
:return: A ``tuple`` with contents outlined as per above.
"""
@@ -354,10 +362,10 @@ class SDBConnection(AWSQueryConnection):
:rtype: bool
:return: True if successful
-
+
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName':domain_name}
+ params = {'DomainName': domain_name}
return self.get_status('DeleteDomain', params)
def domain_metadata(self, domain_or_name):
@@ -371,7 +379,7 @@ class SDBConnection(AWSQueryConnection):
:return: The newly created domain metadata object
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName':domain_name}
+ params = {'DomainName': domain_name}
d = self.get_object('DomainMetadata', params, DomainMetaData)
d.domain = domain
return d
@@ -380,45 +388,45 @@ class SDBConnection(AWSQueryConnection):
replace=True, expected_value=None):
"""
Store attributes for a given item in a domain.
-
+
:type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
:param domain_or_name: Either the name of a domain or a Domain object
-
+
:type item_name: string
:param item_name: The name of the item whose attributes are being
stored.
-
+
:type attribute_names: dict or dict-like object
:param attribute_names: The name/value pairs to store as attributes
-
+
:type expected_value: list
:param expected_value: If supplied, this is a list or tuple consisting
- of a single attribute name and expected value. The list can be
+ of a single attribute name and expected value. The list can be
of the form:
-
+
* ['name', 'value']
-
- In which case the call will first verify that the attribute "name"
+
+ In which case the call will first verify that the attribute "name"
of this item has a value of "value". If it does, the delete
- will proceed, otherwise a ConditionalCheckFailed error will be
+ will proceed, otherwise a ConditionalCheckFailed error will be
returned. The list can also be of the form:
-
+
* ['name', True|False]
-
- which will simply check for the existence (True) or
+
+ which will simply check for the existence (True) or
non-existence (False) of the attribute.
-
+
:type replace: bool
:param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
-
+
:rtype: bool
:return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName' : domain_name,
- 'ItemName' : item_name}
+ params = {'DomainName': domain_name,
+ 'ItemName': item_name}
self._build_name_value_list(params, attributes, replace)
if expected_value:
self._build_expected_value(params, expected_value)
@@ -427,7 +435,7 @@ class SDBConnection(AWSQueryConnection):
def batch_put_attributes(self, domain_or_name, items, replace=True):
"""
Store attributes for multiple items in a domain.
-
+
:type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
:param domain_or_name: Either the name of a domain or a Domain object
@@ -437,17 +445,17 @@ class SDBConnection(AWSQueryConnection):
of attribute names/values, exactly the same as the
attribute_names parameter of the scalar put_attributes
call.
-
+
:type replace: bool
:param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
-
+
:rtype: bool
:return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName' : domain_name}
+ params = {'DomainName': domain_name}
self._build_batch_list(params, items, replace)
return self.get_status('BatchPutAttributes', params, verb='POST')
@@ -460,18 +468,18 @@ class SDBConnection(AWSQueryConnection):
:param domain_or_name: Either the name of a domain or a Domain object
:type item_name: string
- :param item_name: The name of the item whose attributes are
+ :param item_name: The name of the item whose attributes are
being retrieved.
:type attribute_names: string or list of strings
:param attribute_names: An attribute name or list of attribute names.
- This parameter is optional. If not supplied, all attributes will
+ This parameter is optional. If not supplied, all attributes will
be retrieved for the item.
:type consistent_read: bool
:param consistent_read: When set to true, ensures that the most recent
data is returned.
-
+
:type item: :class:`boto.sdb.item.Item`
:keyword item: Instead of instantiating a new Item object, you may
specify one to update.
@@ -480,8 +488,8 @@ class SDBConnection(AWSQueryConnection):
:return: An Item with the requested attribute name/values set on it
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName' : domain_name,
- 'ItemName' : item_name}
+ params = {'DomainName': domain_name,
+ 'ItemName': item_name}
if consistent_read:
params['ConsistentRead'] = 'true'
if attribute_names:
@@ -519,34 +527,35 @@ class SDBConnection(AWSQueryConnection):
delete as the value. If no value is supplied,
all attribute name/values for the item will be
deleted.
-
+
:type expected_value: list
:param expected_value: If supplied, this is a list or tuple consisting
- of a single attribute name and expected value. The list can be
+ of a single attribute name and expected value. The list can be
of the form:
* ['name', 'value']
- In which case the call will first verify that the attribute "name"
+ In which case the call will first verify that the attribute "name"
of this item has a value of "value". If it does, the delete
- will proceed, otherwise a ConditionalCheckFailed error will be
+ will proceed, otherwise a ConditionalCheckFailed error will be
returned. The list can also be of the form:
* ['name', True|False]
- which will simply check for the existence (True) or
+ which will simply check for the existence (True) or
non-existence (False) of the attribute.
:rtype: bool
:return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName':domain_name,
- 'ItemName' : item_name}
+ params = {'DomainName': domain_name,
+ 'ItemName': item_name}
if attr_names:
if isinstance(attr_names, list):
self._build_name_list(params, attr_names)
- elif isinstance(attr_names, dict) or isinstance(attr_names, self.item_cls):
+ elif isinstance(attr_names, dict) or isinstance(attr_names,
+ self.item_cls):
self._build_name_value_list(params, attr_names)
if expected_value:
self._build_expected_value(params, expected_value)
@@ -555,26 +564,26 @@ class SDBConnection(AWSQueryConnection):
def batch_delete_attributes(self, domain_or_name, items):
"""
Delete multiple items in a domain.
-
+
:type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
:param domain_or_name: Either the name of a domain or a Domain object
:type items: dict or dict-like object
:param items: A dictionary-like object. The keys of the dictionary are
the item names and the values are either:
-
+
* dictionaries of attribute names/values, exactly the
same as the attribute_names parameter of the scalar
put_attributes call. The attribute name/value pairs
will only be deleted if they match the name/value
pairs passed in.
* None which means that all attributes associated
- with the item should be deleted.
+ with the item should be deleted.
:return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'DomainName' : domain_name}
+ params = {'DomainName': domain_name}
self._build_batch_list(params, items, False)
return self.get_status('BatchDeleteAttributes', params, verb='POST')
@@ -587,7 +596,7 @@ class SDBConnection(AWSQueryConnection):
Even though the select request does not require a domain object,
a domain object must be passed into this method so the Item objects
returned can point to the appropriate domain.
-
+
:type domain_or_name: string or :class:`boto.sdb.domain.Domain` object
:param domain_or_name: Either the name of a domain or a Domain object
@@ -602,7 +611,7 @@ class SDBConnection(AWSQueryConnection):
:return: An iterator containing the results.
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
- params = {'SelectExpression' : query}
+ params = {'SelectExpression': query}
if consistent_read:
params['ConsistentRead'] = 'true'
if next_token:
diff --git a/boto/sdb/domain.py b/boto/sdb/domain.py
index c8764ff9..75764602 100644
--- a/boto/sdb/domain.py
+++ b/boto/sdb/domain.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -23,7 +23,6 @@
Represents an SDB Domain
"""
from boto.sdb.queryresultset import SelectResultSet
-import boto.compat as compat
class Domain:
@@ -59,32 +58,33 @@ class Domain:
Store attributes for a given item.
:type item_name: string
- :param item_name: The name of the item whose attributes are being stored.
+ :param item_name: The name of the item whose attributes are being
+ stored.
:type attribute_names: dict or dict-like object
:param attribute_names: The name/value pairs to store as attributes
:type expected_value: list
:param expected_value: If supplied, this is a list or tuple consisting
- of a single attribute name and expected value. The list can be
+ of a single attribute name and expected value. The list can be
of the form:
* ['name', 'value']
- In which case the call will first verify that the attribute
- "name" of this item has a value of "value". If it does, the delete
- will proceed, otherwise a ConditionalCheckFailed error will be
- returned. The list can also be of the form:
-
+ In which case the call will first verify that the attribute
+ "name" of this item has a value of "value". If it does, the
+ delete will proceed, otherwise a ConditionalCheckFailed error
+ will be returned. The list can also be of the form:
+
* ['name', True|False]
-
- which will simply check for the existence (True) or non-existence
+
+ which will simply check for the existence (True) or non-existence
(False) of the attribute.
:type replace: bool
:param replace: Whether the attribute values passed in will replace
- existing values or will be added as addition values.
- Defaults to True.
+ existing values or will be added as addition values.
+ Defaults to True.
:rtype: bool
:return: True if successful
@@ -97,16 +97,16 @@ class Domain:
Store attributes for multiple items.
:type items: dict or dict-like object
- :param items: A dictionary-like object. The keys of the dictionary are
- the item names and the values are themselves dictionaries
- of attribute names/values, exactly the same as the
- attribute_names parameter of the scalar put_attributes
- call.
+ :param items: A dictionary-like object. The keys of the
+ dictionary are the item names and the values are
+ themselves dictionaries of attribute names/values, exactly
+ the same as the attribute_names parameter of the scalar
+ put_attributes call.
:type replace: bool
:param replace: Whether the attribute values passed in will replace
- existing values or will be added as addition values.
- Defaults to True.
+ existing values or will be added as addition values.
+ Defaults to True.
:rtype: bool
:return: True if successful
@@ -119,15 +119,17 @@ class Domain:
Retrieve attributes for a given item.
:type item_name: string
- :param item_name: The name of the item whose attributes are being retrieved.
+ :param item_name: The name of the item whose attributes are
+ being retrieved.
:type attribute_names: string or list of strings
- :param attribute_names: An attribute name or list of attribute names. This
- parameter is optional. If not supplied, all attributes
- will be retrieved for the item.
+ :param attribute_names: An attribute name or list of attribute
+ names. This parameter is optional. If not supplied, all
+ attributes will be retrieved for the item.
:rtype: :class:`boto.sdb.item.Item`
- :return: An Item mapping type containing the requested attribute name/values
+ :return: An Item mapping type containing the requested attribute
+ name/values
"""
return self.connection.get_attributes(self, item_name, attribute_name,
consistent_read, item)
@@ -138,30 +140,32 @@ class Domain:
Delete attributes from a given item.
:type item_name: string
- :param item_name: The name of the item whose attributes are being deleted.
+ :param item_name: The name of the item whose attributes are
+ being deleted.
:type attributes: dict, list or :class:`boto.sdb.item.Item`
- :param attributes: Either a list containing attribute names which will cause
- all values associated with that attribute name to be deleted or
- a dict or Item containing the attribute names and keys and list
- of values to delete as the value. If no value is supplied,
- all attribute name/values for the item will be deleted.
-
+ :param attributes: Either a list containing attribute names
+ which will cause all values associated with that attribute
+ name to be deleted or a dict or Item containing the
+ attribute names and keys and list of values to delete as
+ the value. If no value is supplied, all attribute
+ name/values for the item will be deleted.
+
:type expected_value: list
:param expected_value: If supplied, this is a list or tuple consisting
- of a single attribute name and expected value. The list can be of
+ of a single attribute name and expected value. The list can be of
the form:
* ['name', 'value']
In which case the call will first verify that the attribute "name"
of this item has a value of "value". If it does, the delete
- will proceed, otherwise a ConditionalCheckFailed error will be
+ will proceed, otherwise a ConditionalCheckFailed error will be
returned. The list can also be of the form:
* ['name', True|False]
- which will simply check for the existence (True) or
+ which will simply check for the existence (True) or
non-existence (False) of the attribute.
:rtype: bool
@@ -173,10 +177,10 @@ class Domain:
def batch_delete_attributes(self, items):
"""
Delete multiple items in this domain.
-
+
:type items: dict or dict-like object
- :param items: A dictionary-like object. The keys of the dictionary are
- the item names and the values are either:
+ :param items: A dictionary-like object. The keys of the dictionary
+ are the item names and the values are either:
* dictionaries of attribute names/values, exactly the
same as the attribute_names parameter of the scalar
@@ -184,39 +188,42 @@ class Domain:
will only be deleted if they match the name/value
pairs passed in.
* None which means that all attributes associated
- with the item should be deleted.
+ with the item should be deleted.
:rtype: bool
:return: True if successful
"""
return self.connection.batch_delete_attributes(self, items)
- def select(self, query='', next_token=None, consistent_read=False, max_items=None):
+ def select(self, query='', next_token=None, consistent_read=False,
+ max_items=None):
"""
- Returns a set of Attributes for item names within domain_name that match the query.
- The query must be expressed in using the SELECT style syntax rather than the
- original SimpleDB query language.
+ Returns a set of Attributes for item names within domain_name
+ that match the query. The query must be expressed in using
+ the SELECT style syntax rather than the original SimpleDB
+ query language.
:type query: string
:param query: The SimpleDB query to be performed.
:rtype: iter
- :return: An iterator containing the results. This is actually a generator
- function that will iterate across all search results, not just the
- first page.
+ :return: An iterator containing the results. This is actually
+ a generator function that will iterate across all search
+ results, not just the first page.
"""
- return SelectResultSet(self, query, max_items=max_items, next_token=next_token,
+ return SelectResultSet(self, query, max_items=max_items,
+ next_token=next_token,
consistent_read=consistent_read)
def get_item(self, item_name, consistent_read=False):
"""
Retrieves an item from the domain, along with all of its attributes.
-
+
:param string item_name: The name of the item to retrieve.
:rtype: :class:`boto.sdb.item.Item` or ``None``
- :keyword bool consistent_read: When set to true, ensures that the most
+ :keyword bool consistent_read: When set to true, ensures that the most
recent data is returned.
- :return: The requested item, or ``None`` if there was no match found
+ :return: The requested item, or ``None`` if there was no match found
"""
item = self.get_attributes(item_name, consistent_read=consistent_read)
if item:
@@ -266,7 +273,6 @@ class Domain:
# f.seek(0)
# return f
-
def from_xml(self, doc):
"""Load this domain based on an XML document"""
import xml.sax
@@ -315,6 +321,8 @@ class DomainMetaData:
import sys
from xml.sax.handler import ContentHandler
+
+
class DomainDumpParser(ContentHandler):
"""
SAX parser for a domain that has been dumped
@@ -360,6 +368,8 @@ class DomainDumpParser(ContentHandler):
self.uploader.start()
from threading import Thread
+
+
class UploaderThread(Thread):
"""Uploader Thread"""
diff --git a/boto/sdb/item.py b/boto/sdb/item.py
index 999c7f0b..ba569a71 100644
--- a/boto/sdb/item.py
+++ b/boto/sdb/item.py
@@ -14,34 +14,37 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import base64
+
class Item(dict):
"""
A ``dict`` sub-class that serves as an object representation of a
SimpleDB item. An item in SDB is similar to a row in a relational
database. Items belong to a :py:class:`Domain <boto.sdb.domain.Domain>`,
which is similar to a table in a relational database.
-
+
The keys on instances of this object correspond to attributes that are
- stored on the SDB item.
-
- .. tip:: While it is possible to instantiate this class directly, you may
- want to use the convenience methods on :py:class:`boto.sdb.domain.Domain`
- for that purpose. For example, :py:meth:`boto.sdb.domain.Domain.get_item`.
+ stored on the SDB item.
+
+ .. tip:: While it is possible to instantiate this class directly,
+ you may want to use the convenience methods on
+ :py:class:`boto.sdb.domain.Domain`
+ for that purpose. For example,
+ :py:meth:`boto.sdb.domain.Domain.get_item`.
"""
def __init__(self, domain, name='', active=False):
"""
:type domain: :py:class:`boto.sdb.domain.Domain`
:param domain: The domain that this item belongs to.
-
+
:param str name: The name of this item. This name will be used when
- querying for items using methods like
+ querying for items using methods like
:py:meth:`boto.sdb.domain.Domain.get_item`
"""
dict.__init__(self)
@@ -102,8 +105,8 @@ class Item(dict):
def load(self):
"""
Loads or re-loads this item's attributes from SDB.
-
- .. warning::
+
+ .. warning::
If you have changed attribute values on an Item instance,
this method will over-write the values if they are different in
SDB. For any local attributes that don't yet exist in SDB,
@@ -114,7 +117,7 @@ class Item(dict):
def save(self, replace=True):
"""
Saves this item to SDB.
-
+
:param bool replace: If ``True``, delete any attributes on the remote
SDB item that have a ``None`` value on this object.
"""
@@ -134,11 +137,11 @@ class Item(dict):
attribute that has yet to be set, it will simply create an attribute
named ``key`` with your given ``value`` as its value. If you are
adding a value to an existing attribute, this method will convert the
- attribute to a list (if it isn't already) and append your new value
+ attribute to a list (if it isn't already) and append your new value
to said list.
-
+
For clarification, consider the following interactive session:
-
+
.. code-block:: python
>>> item = some_domain.get_item('some_item')
@@ -150,9 +153,9 @@ class Item(dict):
>>> item.add_value('some_attr', 2)
>>> item['some_attr']
[1, 2]
-
+
:param str key: The attribute to add a value to.
- :param object value: The value to set or append to the attribute.
+ :param object value: The value to set or append to the attribute.
"""
if key in self:
# We already have this key on the item.
@@ -170,12 +173,8 @@ class Item(dict):
def delete(self):
"""
Deletes this item in SDB.
-
+
.. note:: This local Python object remains in its current state
after deletion, this only deletes the remote item in SDB.
"""
self.domain.delete_item(self)
-
-
-
-
diff --git a/boto/sdb/queryresultset.py b/boto/sdb/queryresultset.py
index 10bafd1c..16b7d0a0 100644
--- a/boto/sdb/queryresultset.py
+++ b/boto/sdb/queryresultset.py
@@ -14,11 +14,12 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+
def query_lister(domain, query='', max_items=None, attr_names=None):
more_results = True
num_results = 0
@@ -34,7 +35,8 @@ def query_lister(domain, query='', max_items=None, attr_names=None):
num_results += 1
next_token = rs.next_token
more_results = next_token != None
-
+
+
class QueryResultSet:
def __init__(self, domain=None, query='', max_items=None, attr_names=None):
@@ -44,7 +46,9 @@ class QueryResultSet:
self.attr_names = attr_names
def __iter__(self):
- return query_lister(self.domain, self.query, self.max_items, self.attr_names)
+ return query_lister(self.domain, self.query, self.max_items,
+ self.attr_names)
+
def select_lister(domain, query='', max_items=None):
more_results = True
@@ -60,7 +64,8 @@ def select_lister(domain, query='', max_items=None):
num_results += 1
next_token = rs.next_token
more_results = next_token != None
-
+
+
class SelectResultSet(object):
def __init__(self, domain=None, query='', max_items=None,
diff --git a/boto/sdb/regioninfo.py b/boto/sdb/regioninfo.py
index 5c32864d..c4f6e449 100644
--- a/boto/sdb/regioninfo.py
+++ b/boto/sdb/regioninfo.py
@@ -16,7 +16,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -24,6 +24,7 @@
from boto.regioninfo import RegionInfo
+
class SDBRegionInfo(RegionInfo):
def __init__(self, connection=None, name=None, endpoint=None):
diff --git a/boto/ses/__init__.py b/boto/ses/__init__.py
index 01cf8dec..fdb7324c 100644
--- a/boto/ses/__init__.py
+++ b/boto/ses/__init__.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -23,6 +23,7 @@
from .connection import SESConnection
from boto.regioninfo import RegionInfo
+
def regions():
"""
Get all available regions for the SES service.
@@ -34,14 +35,15 @@ def regions():
endpoint='email.us-east-1.amazonaws.com',
connection_cls=SESConnection)]
+
def connect_to_region(region_name, **kw_params):
"""
- Given a valid region name, return a
+ Given a valid region name, return a
:class:`boto.sns.connection.SESConnection`.
:type: str
:param region_name: The name of the region to connect to.
-
+
:rtype: :class:`boto.sns.connection.SESConnection` or ``None``
:return: A connection to the given region, or None if an invalid region
name is given
@@ -51,6 +53,7 @@ def connect_to_region(region_name, **kw_params):
return region.connect(**kw_params)
return None
+
def get_region(region_name, **kw_params):
"""
Find and return a :class:`boto.regioninfo.RegionInfo` object
diff --git a/boto/ses/connection.py b/boto/ses/connection.py
index ba58a62f..8702dbd6 100644
--- a/boto/ses/connection.py
+++ b/boto/ses/connection.py
@@ -89,7 +89,7 @@ class SESConnection(AWSAuthConnection):
params['Action'] = action
for k, v in params.items():
- if isinstance(v, compat.text_types): # UTF-8 encode only if it's Unicode
+ if isinstance(v, compat.text_types): # encode only if it's Unicode
params[k] = v.encode('utf-8')
response = super(SESConnection, self).make_request(
@@ -152,7 +152,8 @@ class SESConnection(AWSAuthConnection):
raise ExceptionToRaise(response.status, exc_reason, body)
- def send_email(self, source, subject, body, to_addresses, cc_addresses=None,
+ def send_email(self, source, subject, body,
+ to_addresses, cc_addresses=None,
bcc_addresses=None, format='text', reply_addresses=None,
return_path=None, text_body=None, html_body=None):
"""Composes an email message based on input data, and then immediately
@@ -191,9 +192,9 @@ class SESConnection(AWSAuthConnection):
:param return_path: The email address to which bounce notifications are
to be forwarded. If the message cannot be delivered
to the recipient, then an error message will be
- returned from the recipient's ISP; this message will
- then be forwarded to the email address specified by
- the ReturnPath parameter.
+ returned from the recipient's ISP; this message
+ will then be forwarded to the email address
+ specified by the ReturnPath parameter.
:type text_body: string
:param text_body: The text body to send with this email.
@@ -226,7 +227,7 @@ class SESConnection(AWSAuthConnection):
if text_body is not None:
params['Message.Body.Text.Data'] = text_body
- if(format not in ("text","html")):
+ if(format not in ("text", "html")):
raise ValueError("'format' argument must be 'text' or 'html'")
if(not (html_body or text_body)):
@@ -267,7 +268,8 @@ class SESConnection(AWSAuthConnection):
:param raw_message: The raw text of the message. The client is
responsible for ensuring the following:
- - Message must contain a header and a body, separated by a blank line.
+ - Message must contain a header and a body, separated by
+ a blank line.
- All required header fields must be present.
- Each part of a multipart MIME message must be formatted properly.
- MIME content types must be among those supported by Amazon SES.
diff --git a/boto/ses/exceptions.py b/boto/ses/exceptions.py
index 753b4eee..8703ca01 100644
--- a/boto/ses/exceptions.py
+++ b/boto/ses/exceptions.py
@@ -3,6 +3,7 @@ Various exceptions that are specific to the SES module.
"""
from boto.exception import BotoServerError
+
class SESAddressNotVerifiedError(BotoServerError):
"""
Raised when a "Reply-To" address has not been validated in SES yet.
@@ -39,4 +40,4 @@ class SESDomainEndsWithDotError(BotoServerError):
"""
Recipient's email address' domain ends with a period/dot.
"""
- pass \ No newline at end of file
+ pass
diff --git a/boto/sns/__init__.py b/boto/sns/__init__.py
index 1ae5d197..434e959f 100644
--- a/boto/sns/__init__.py
+++ b/boto/sns/__init__.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@
from .connection import SNSConnection
from boto.regioninfo import RegionInfo
+
def regions():
"""
Get all available regions for the SNS service.
@@ -55,14 +56,15 @@ def regions():
connection_cls=SNSConnection),
]
+
def connect_to_region(region_name, **kw_params):
"""
- Given a valid region name, return a
+ Given a valid region name, return a
:class:`boto.sns.connection.SNSConnection`.
:type: str
:param region_name: The name of the region to connect to.
-
+
:rtype: :class:`boto.sns.connection.SNSConnection` or ``None``
:return: A connection to the given region, or None if an invalid region
name is given
@@ -72,6 +74,7 @@ def connect_to_region(region_name, **kw_params):
return region.connect(**kw_params)
return None
+
def get_region(region_name, **kw_params):
"""
Find and return a :class:`boto.regioninfo.RegionInfo` object
diff --git a/boto/sns/connection.py b/boto/sns/connection.py
index 0f24bc8e..9dcfbae7 100644
--- a/boto/sns/connection.py
+++ b/boto/sns/connection.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -60,7 +60,7 @@ class SNSConnection(AWSQueryConnection):
this method.
"""
- params = {'ContentType' : 'JSON'}
+ params = {'ContentType': 'JSON'}
if next_token:
params['NextToken'] = next_token
response = self.make_request('ListTopics', params, '/', 'GET')
@@ -71,7 +71,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def get_topic_attributes(self, topic):
"""
Get attributes of a Topic
@@ -80,8 +80,8 @@ class SNSConnection(AWSQueryConnection):
:param topic: The ARN of the topic.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic}
response = self.make_request('GetTopicAttributes', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -90,7 +90,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def set_topic_attributes(self, topic, attr_name, attr_value):
"""
Get attributes of a Topic
@@ -107,10 +107,10 @@ class SNSConnection(AWSQueryConnection):
:param attr_value: The new value for the attribute.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'AttributeName' : attr_name,
- 'AttributeValue' : attr_value}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'AttributeName': attr_name,
+ 'AttributeValue': attr_value}
response = self.make_request('SetTopicAttributes', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -119,7 +119,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def add_permission(self, topic, label, account_ids, actions):
"""
Adds a statement to a topic's access control policy, granting
@@ -140,9 +140,9 @@ class SNSConnection(AWSQueryConnection):
specified principal(s).
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'Label' : label}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'Label': label}
self.build_list_params(params, account_ids, 'AWSAccountId')
self.build_list_params(params, actions, 'ActionName')
response = self.make_request('AddPermission', params, '/', 'GET')
@@ -153,7 +153,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def remove_permission(self, topic, label):
"""
Removes a statement from a topic's access control policy.
@@ -166,9 +166,9 @@ class SNSConnection(AWSQueryConnection):
to be removed.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'Label' : label}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'Label': label}
response = self.make_request('RemovePermission', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -177,7 +177,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def create_topic(self, topic):
"""
Create a new Topic.
@@ -186,8 +186,8 @@ class SNSConnection(AWSQueryConnection):
:param topic: The name of the new topic.
"""
- params = {'ContentType' : 'JSON',
- 'Name' : topic}
+ params = {'ContentType': 'JSON',
+ 'Name': topic}
response = self.make_request('CreateTopic', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -205,8 +205,8 @@ class SNSConnection(AWSQueryConnection):
:param topic: The ARN of the topic
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic}
response = self.make_request('DeleteTopic', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -216,8 +216,6 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
-
def publish(self, topic, message, subject=None):
"""
Get properties of a Topic
@@ -235,9 +233,9 @@ class SNSConnection(AWSQueryConnection):
line of the email notifications.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'Message' : message}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'Message': message}
if subject:
params['Subject'] = subject
response = self.make_request('Publish', params, '/', 'GET')
@@ -248,7 +246,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def subscribe(self, topic, protocol, endpoint):
"""
Subscribe to a Topic.
@@ -271,10 +269,10 @@ class SNSConnection(AWSQueryConnection):
* For sqs, this would be the ARN of an SQS Queue
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'Protocol' : protocol,
- 'Endpoint' : endpoint}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'Protocol': protocol,
+ 'Endpoint': endpoint}
response = self.make_request('Subscribe', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -289,9 +287,9 @@ class SNSConnection(AWSQueryConnection):
Subscribe an SQS queue to a topic.
This is convenience method that handles most of the complexity involved
- in using ans SQS queue as an endpoint for an SNS topic. To achieve this
- the following operations are performed:
-
+ in using ans SQS queue as an endpoint for an SNS topic. To achieve
+ this the following operations are performed:
+
* The correct ARN is constructed for the SQS queue and that ARN is
then subscribed to the topic.
* A JSON policy document is contructed that grants permission to
@@ -300,7 +298,7 @@ class SNSConnection(AWSQueryConnection):
the queue's set_attribute method. If the queue already has
a policy associated with it, this process will add a Statement to
that policy. If no policy exists, a new policy will be created.
-
+
:type topic: string
:param topic: The name of the new topic.
@@ -316,12 +314,12 @@ class SNSConnection(AWSQueryConnection):
policy['Version'] = '2008-10-17'
if 'Statement' not in policy:
policy['Statement'] = []
- statement = {'Action' : 'SQS:SendMessage',
- 'Effect' : 'Allow',
+ statement = {'Action': 'SQS:SendMessage',
+ 'Effect': 'Allow',
'Principal' : {'AWS' : '*'},
- 'Resource' : q_arn,
- 'Sid' : str(uuid.uuid4()),
- 'Condition' : {'StringLike' : {'aws:SourceArn' : topic}}}
+ 'Resource': q_arn,
+ 'Sid': str(uuid.uuid4()),
+ 'Condition': {'StringLike' : {'aws:SourceArn' : topic}}}
policy['Statement'].append(statement)
queue.set_attribute('Policy', compat.json.dumps(policy))
return resp
@@ -345,9 +343,9 @@ class SNSConnection(AWSQueryConnection):
of the subscription.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic,
- 'Token' : token}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic,
+ 'Token': token}
if authenticate_on_unsubscribe:
params['AuthenticateOnUnsubscribe'] = 'true'
response = self.make_request('ConfirmSubscription', params, '/', 'GET')
@@ -358,7 +356,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def unsubscribe(self, subscription):
"""
Allows endpoint owner to delete subscription.
@@ -368,8 +366,8 @@ class SNSConnection(AWSQueryConnection):
:param subscription: The ARN of the subscription to be deleted.
"""
- params = {'ContentType' : 'JSON',
- 'SubscriptionArn' : subscription}
+ params = {'ContentType': 'JSON',
+ 'SubscriptionArn': subscription}
response = self.make_request('Unsubscribe', params, '/', 'GET')
body = response.read()
if response.status == 200:
@@ -378,7 +376,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def get_all_subscriptions(self, next_token=None):
"""
Get list of all subscriptions.
@@ -388,7 +386,7 @@ class SNSConnection(AWSQueryConnection):
this method.
"""
- params = {'ContentType' : 'JSON'}
+ params = {'ContentType': 'JSON'}
if next_token:
params['NextToken'] = next_token
response = self.make_request('ListSubscriptions', params, '/', 'GET')
@@ -399,7 +397,7 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
+
def get_all_subscriptions_by_topic(self, topic, next_token=None):
"""
Get list of all subscriptions to a specific topic.
@@ -413,8 +411,8 @@ class SNSConnection(AWSQueryConnection):
this method.
"""
- params = {'ContentType' : 'JSON',
- 'TopicArn' : topic}
+ params = {'ContentType': 'JSON',
+ 'TopicArn': topic}
if next_token:
params['NextToken'] = next_token
response = self.make_request('ListSubscriptionsByTopic', params,
@@ -426,4 +424,3 @@ class SNSConnection(AWSQueryConnection):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
diff --git a/boto/sqs/__init__.py b/boto/sqs/__init__.py
index 170ca1ea..38caadcb 100644
--- a/boto/sqs/__init__.py
+++ b/boto/sqs/__init__.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -22,10 +22,11 @@
from .regioninfo import SQSRegionInfo
+
def regions():
"""
Get all available regions for the SQS service.
-
+
:rtype: list
:return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
"""
@@ -45,6 +46,7 @@ def regions():
endpoint='sqs.ap-southeast-1.amazonaws.com')
]
+
def connect_to_region(region_name, **kw_params):
for region in regions():
if region.name == region_name:
diff --git a/boto/sqs/attributes.py b/boto/sqs/attributes.py
index 26c72041..4dbd4f84 100644
--- a/boto/sqs/attributes.py
+++ b/boto/sqs/attributes.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -23,8 +23,9 @@
Represents an SQS Attribute Name/Value set
"""
+
class Attributes(dict):
-
+
def __init__(self, parent):
self.parent = parent
self.current_key = None
@@ -42,5 +43,3 @@ class Attributes(dict):
self.current_value = value
else:
setattr(self, name, value)
-
-
diff --git a/boto/sqs/batchresults.py b/boto/sqs/batchresults.py
index e11bef8a..feb52cbe 100644
--- a/boto/sqs/batchresults.py
+++ b/boto/sqs/batchresults.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -24,6 +24,7 @@
A set of results returned by SendMessageBatch.
"""
+
class ResultEntry(dict):
"""
The result (successful or unsuccessful) of a single
@@ -61,7 +62,8 @@ class ResultEntry(dict):
self['error_code'] = value
elif name == 'Message':
self['error_message'] = value
-
+
+
class BatchResults(object):
"""
A container for the results of a send_message_batch request.
@@ -72,7 +74,7 @@ class BatchResults(object):
:ivar errors: A list of unsuccessful results. Each item in the
list will be an instance of :class:`ResultEntry`.
"""
-
+
def __init__(self, parent):
self.parent = parent
self.results = []
@@ -91,5 +93,3 @@ class BatchResults(object):
def endElement(self, name, value, connection):
setattr(self, name, value)
-
-
diff --git a/boto/sqs/connection.py b/boto/sqs/connection.py
index 7e055dd5..ebfcf5f8 100644
--- a/boto/sqs/connection.py
+++ b/boto/sqs/connection.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -73,7 +73,8 @@ class SQSConnection(AWSQueryConnection):
of that name. This is still an expensive operation,
though, and not the preferred way to check for
the existence of a queue. See the
- :func:`boto.sqs.connection.SQSConnection.lookup` method.
+ :func:`boto.sqs.connection.SQSConnection.lookup`
+ method.
:type visibility_timeout: int
:param visibility_timeout: The default visibility timeout for all
@@ -96,7 +97,7 @@ class SQSConnection(AWSQueryConnection):
:type queue: A Queue object
:param queue: The SQS queue to be deleted
-
+
:type force_deletion: Boolean
:param force_deletion: Normally, SQS will not delete a queue that
contains messages. However, if the
@@ -105,7 +106,7 @@ class SQSConnection(AWSQueryConnection):
there are messages in the queue or not.
USE WITH CAUTION. This will delete all
messages in the queue as well.
-
+
:rtype: bool
:return: True if the command succeeded, False otherwise
"""
@@ -114,7 +115,7 @@ class SQSConnection(AWSQueryConnection):
def get_queue_attributes(self, queue, attribute='All'):
"""
Gets one or all attributes of a Queue
-
+
:type queue: A Queue object
:param queue: The SQS queue to be deleted
@@ -122,23 +123,23 @@ class SQSConnection(AWSQueryConnection):
:type attribute: The specific attribute requested. If not supplied,
the default is to return all attributes.
Valid attributes are:
-
+
ApproximateNumberOfMessages|
ApproximateNumberOfMessagesNotVisible|
VisibilityTimeout|
CreatedTimestamp|
LastModifiedTimestamp|
Policy
-
+
:rtype: :class:`boto.sqs.attributes.Attributes`
:return: An Attributes object containing request value(s).
"""
- params = {'AttributeName' : attribute}
+ params = {'AttributeName': attribute}
return self.get_object('GetQueueAttributes', params,
Attributes, queue.id)
def set_queue_attribute(self, queue, attribute, value):
- params = {'Attribute.Name' : attribute, 'Attribute.Value' : value}
+ params = {'Attribute.Name': attribute, 'Attribute.Value': value}
return self.get_status('SetQueueAttributes', params, queue.id)
def receive_message(self, queue, number_messages=1,
@@ -148,11 +149,11 @@ class SQSConnection(AWSQueryConnection):
:type queue: A Queue object
:param queue: The Queue from which messages are read.
-
+
:type number_messages: int
:param number_messages: The maximum number of messages to read
(default=1)
-
+
:type visibility_timeout: int
:param visibility_timeout: The number of seconds the message should
remain invisible to other queue readers
@@ -163,15 +164,15 @@ class SQSConnection(AWSQueryConnection):
with response or All if you want all attributes.
The default is to return no additional attributes.
Valid values:
-
+
All|SenderId|SentTimestamp|
ApproximateReceiveCount|
ApproximateFirstReceiveTimestamp
-
+
:rtype: list
:return: A list of :class:`boto.sqs.message.Message` objects.
"""
- params = {'MaxNumberOfMessages' : number_messages}
+ params = {'MaxNumberOfMessages': number_messages}
if visibility_timeout:
params['VisibilityTimeout'] = visibility_timeout
if attributes:
@@ -186,14 +187,14 @@ class SQSConnection(AWSQueryConnection):
:type queue: A :class:`boto.sqs.queue.Queue` object
:param queue: The Queue from which messages are read.
-
+
:type message: A :class:`boto.sqs.message.Message` object
:param message: The Message to be deleted
-
+
:rtype: bool
:return: True if successful, False otherwise.
"""
- params = {'ReceiptHandle' : message.receipt_handle}
+ params = {'ReceiptHandle': message.receipt_handle}
return self.get_status('DeleteMessage', params, queue.id)
def delete_message_from_handle(self, queue, receipt_handle):
@@ -202,18 +203,18 @@ class SQSConnection(AWSQueryConnection):
:type queue: A :class:`boto.sqs.queue.Queue` object
:param queue: The Queue from which messages are read.
-
+
:type receipt_handle: str
:param receipt_handle: The receipt handle for the message
-
+
:rtype: bool
:return: True if successful, False otherwise.
"""
- params = {'ReceiptHandle' : receipt_handle}
+ params = {'ReceiptHandle': receipt_handle}
return self.get_status('DeleteMessage', params, queue.id)
def send_message(self, queue, message_content, delay_seconds=None):
- params = {'MessageBody' : message_content}
+ params = {'MessageBody': message_content}
if delay_seconds:
params['DelaySeconds'] = int(delay_seconds)
return self.get_object('SendMessage', params, Message,
@@ -238,11 +239,11 @@ class SQSConnection(AWSQueryConnection):
"""
params = {}
for i, msg in enumerate(messages):
- p_name = 'SendMessageBatchRequestEntry.%i.Id' % (i+1)
+ p_name = 'SendMessageBatchRequestEntry.%i.Id' % (i + 1)
params[p_name] = msg[0]
- p_name = 'SendMessageBatchRequestEntry.%i.MessageBody' % (i+1)
+ p_name = 'SendMessageBatchRequestEntry.%i.MessageBody' % (i + 1)
params[p_name] = msg[1]
- p_name = 'SendMessageBatchRequestEntry.%i.DelaySeconds' % (i+1)
+ p_name = 'SendMessageBatchRequestEntry.%i.DelaySeconds' % (i + 1)
params[p_name] = msg[2]
return self.get_object('SendMessageBatch', params, BatchResults,
queue.id, verb='POST')
@@ -255,17 +256,17 @@ class SQSConnection(AWSQueryConnection):
:type queue: A :class:`boto.sqs.queue.Queue` object
:param queue: The Queue from which messages are read.
-
+
:type receipt_handle: str
:param queue: The receipt handle associated with the message whose
visibility timeout will be changed.
-
+
:type visibility_timeout: int
:param visibility_timeout: The new value of the message's visibility
timeout in seconds.
"""
- params = {'ReceiptHandle' : receipt_handle,
- 'VisibilityTimeout' : visibility_timeout}
+ params = {'ReceiptHandle': receipt_handle,
+ 'VisibilityTimeout': visibility_timeout}
return self.get_status('ChangeMessageVisibility', params, queue.id)
def get_all_queues(self, prefix=''):
@@ -311,7 +312,8 @@ class SQSConnection(AWSQueryConnection):
:param queue: The queue object
:type label: str or unicode
- :param label: A unique identification of the permission you are setting.
+ :param label: A unique identification of the permission you are
+ setting.
Maximum of 80 characters ``[0-9a-zA-Z_-]``
Example, AliceSendMessage
@@ -332,8 +334,8 @@ class SQSConnection(AWSQueryConnection):
"""
params = {'Label': label,
- 'AWSAccountId' : aws_account_id,
- 'ActionName' : action_name}
+ 'AWSAccountId': aws_account_id,
+ 'ActionName': action_name}
return self.get_status('AddPermission', params, queue.id)
def remove_permission(self, queue, label):
@@ -352,8 +354,3 @@ class SQSConnection(AWSQueryConnection):
"""
params = {'Label': label}
return self.get_status('RemovePermission', params, queue.id)
-
-
-
-
-
diff --git a/boto/sqs/jsonmessage.py b/boto/sqs/jsonmessage.py
index c517874a..8b845db0 100644
--- a/boto/sqs/jsonmessage.py
+++ b/boto/sqs/jsonmessage.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -24,9 +24,11 @@ from boto.exception import SQSDecodeError
import base64
import boto.compat as compat
+
class JSONMessage(MHMessage):
"""
- Acts like a dictionary but encodes it's data as a Base64 encoded JSON payload.
+ Acts like a dictionary but encodes it's data as a Base64 encoded
+ JSON payload.
"""
def decode(self, value):
diff --git a/boto/sqs/message.py b/boto/sqs/message.py
index 2b6b3b86..7366d96a 100644
--- a/boto/sqs/message.py
+++ b/boto/sqs/message.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -22,45 +22,55 @@
"""
SQS Message
-A Message represents the data stored in an SQS queue. The rules for what is allowed within an SQS
-Message are here:
+A Message represents the data stored in an SQS queue. The rules for
+what is allowed within an SQS Message are here:
http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/Query_QuerySendMessage.html
-So, at it's simplest level a Message just needs to allow a developer to store bytes in it and get the bytes
-back out. However, to allow messages to have richer semantics, the Message class must support the
+So, at it's simplest level a Message just needs to allow a developer
+to store bytes in it and get the bytes back out. However, to allow
+messages to have richer semantics, the Message class must support the
following interfaces:
-The constructor for the Message class must accept a keyword parameter "queue" which is an instance of a
-boto Queue object and represents the queue that the message will be stored in. The default value for
-this parameter is None.
-
-The constructor for the Message class must accept a keyword parameter "body" which represents the
-content or body of the message. The format of this parameter will depend on the behavior of the
-particular Message subclass. For example, if the Message subclass provides dictionary-like behavior to the
-user the body passed to the constructor should be a dict-like object that can be used to populate
+The constructor for the Message class must accept a keyword parameter
+"queue" which is an instance of a boto Queue object and represents the
+queue that the message will be stored in. The default value for this
+parameter is None.
+
+The constructor for the Message class must accept a keyword parameter
+"body" which represents the content or body of the message. The
+format of this parameter will depend on the behavior of the particular
+Message subclass. For example, if the Message subclass provides
+dictionary-like behavior to the user the body passed to the
+constructor should be a dict-like object that can be used to populate
the initial state of the message.
-The Message class must provide an encode method that accepts a value of the same type as the body
-parameter of the constructor and returns a string of characters that are able to be stored in an
-SQS message body (see rules above).
+The Message class must provide an encode method that accepts a value
+of the same type as the body parameter of the constructor and returns
+a string of characters that are able to be stored in an SQS message
+body (see rules above).
-The Message class must provide a decode method that accepts a string of characters that can be
-stored (and probably were stored!) in an SQS message and return an object of a type that is consistent
-with the "body" parameter accepted on the class constructor.
+The Message class must provide a decode method that accepts a string
+of characters that can be stored (and probably were stored!) in an SQS
+message and return an object of a type that is consistent with the
+"body" parameter accepted on the class constructor.
-The Message class must provide a __len__ method that will return the size of the encoded message
-that would be stored in SQS based on the current state of the Message object.
+The Message class must provide a __len__ method that will return the
+size of the encoded message that would be stored in SQS based on the
+current state of the Message object.
-The Message class must provide a get_body method that will return the body of the message in the
-same format accepted in the constructor of the class.
+The Message class must provide a get_body method that will return the
+body of the message in the same format accepted in the constructor of
+the class.
-The Message class must provide a set_body method that accepts a message body in the same format
-accepted by the constructor of the class. This method should alter to the internal state of the
-Message object to reflect the state represented in the message body parameter.
+The Message class must provide a set_body method that accepts a
+message body in the same format accepted by the constructor of the
+class. This method should alter to the internal state of the Message
+object to reflect the state represented in the message body parameter.
-The Message class must provide a get_body_encoded method that returns the current body of the message
-in the format in which it would be stored in SQS.
+The Message class must provide a get_body_encoded method that returns
+the current body of the message in the format in which it would be
+stored in SQS.
"""
import base64
@@ -68,6 +78,7 @@ from boto.sqs.attributes import Attributes
from boto.exception import SQSDecodeError
import boto.compat as compat
+
class RawMessage:
"""
Base class for SQS messages. RawMessage does not encode the message
@@ -75,7 +86,7 @@ class RawMessage:
will be written to SQS and whatever is returned from SQS is stored
directly into the body of the message.
"""
-
+
def __init__(self, queue=None, body=''):
self.queue = queue
self.set_body(body)
@@ -111,19 +122,20 @@ class RawMessage:
def decode(self, value):
"""Transform seralized byte array into any object."""
return value
-
+
def set_body(self, body):
"""Override the current body for this object, using decoded format."""
self._body = body
def get_body(self):
return self._body
-
+
def get_body_encoded(self):
"""
- This method is really a semi-private method used by the Queue.write
- method when writing the contents of the message to SQS.
- You probably shouldn't need to call this method in the normal course of events.
+ This method is really a semi-private method used by the
+ Queue.write method when writing the contents of the message to
+ SQS. You probably shouldn't need to call this method in the
+ normal course of events.
"""
return self.encode(self.get_body())
@@ -136,7 +148,8 @@ class RawMessage:
self.queue.connection.change_message_visibility(self.queue,
self.receipt_handle,
visibility_timeout)
-
+
+
class Message(RawMessage):
"""
The default Message class used for SQS queues. This class automatically
@@ -148,7 +161,7 @@ class Message(RawMessage):
for details on why this is a good idea. The encode/decode is meant to
be transparent to the end-user.
"""
-
+
def encode(self, value):
if isinstance(value, compat.text_type):
value = value.encode('utf-8')
@@ -161,6 +174,7 @@ class Message(RawMessage):
raise SQSDecodeError('Unable to decode message', self)
return value
+
class MHMessage(Message):
"""
The MHMessage class provides a message that provides RFC821-like
@@ -186,7 +200,7 @@ class MHMessage(Message):
while line:
delim = line.find(':')
key = line[0:delim]
- value = line[delim+1:].strip()
+ value = line[delim + 1:].strip()
msg[key.strip()] = value.strip()
line = fp.readline()
except:
@@ -228,6 +242,7 @@ class MHMessage(Message):
def get(self, key, default=None):
return self._body.get(key, default)
+
class EncodedMHMessage(MHMessage):
"""
The EncodedMHMessage class provides a message that provides RFC821-like
@@ -235,9 +250,9 @@ class EncodedMHMessage(MHMessage):
HeaderName: HeaderValue
- This variation encodes/decodes the body of the message in base64 automatically.
- The message instance can be treated like a mapping object,
- i.e. m['HeaderName'] would return 'HeaderValue'.
+ This variation encodes/decodes the body of the message in base64
+ automatically. The message instance can be treated like a mapping
+ object, i.e. m['HeaderName'] would return 'HeaderValue'.
"""
def decode(self, value):
@@ -250,4 +265,3 @@ class EncodedMHMessage(MHMessage):
def encode(self, value):
value = MHMessage.encode(self, value)
return base64.b64encode(value)
-
diff --git a/boto/sqs/queue.py b/boto/sqs/queue.py
index eee88f31..bcfe8de4 100644
--- a/boto/sqs/queue.py
+++ b/boto/sqs/queue.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -67,9 +67,10 @@ class Queue:
def set_message_class(self, message_class):
"""
- Set the message class that should be used when instantiating messages read
- from the queue. By default, the class boto.sqs.message.Message is used but
- this can be overriden with any class that behaves like a message.
+ Set the message class that should be used when instantiating
+ messages read from the queue. By default, the class
+ boto.sqs.message.Message is used but this can be overriden
+ with any class that behaves like a message.
:type message_class: Message-like class
:param message_class: The new Message class
@@ -98,7 +99,7 @@ class Queue:
def set_attribute(self, attribute, value):
"""
Set a new value for an attribute of the Queue.
-
+
:type attribute: String
:param attribute: The name of the attribute you want to set. The
only valid value at this time is: VisibilityTimeout
@@ -115,7 +116,7 @@ class Queue:
def get_timeout(self):
"""
Get the visibility timeout for the queue.
-
+
:rtype: int
:return: The number of seconds as an integer.
"""
@@ -139,15 +140,16 @@ class Queue:
Add a permission to a queue.
:type label: str or unicode
- :param label: A unique identification of the permission you are setting.
- Maximum of 80 characters ``[0-9a-zA-Z_-]``
+ :param label: A unique identification of the permission you
+ are setting. Maximum of 80 characters ``[0-9a-zA-Z_-]``
Example, AliceSendMessage
:type aws_account_id: str or unicode
- :param principal_id: The AWS account number of the principal who will be given
- permission. The principal must have an AWS account, but
- does not need to be signed up for Amazon SQS. For information
- about locating the AWS account identification.
+ :param principal_id: The AWS account number of the principal
+ who will be given permission. The principal must have an
+ AWS account, but does not need to be signed up for Amazon
+ SQS. For information about locating the AWS account
+ identification.
:type action_name: str or unicode
:param action_name: The action. Valid choices are:
@@ -158,14 +160,16 @@ class Queue:
:return: True if successful, False otherwise.
"""
- return self.connection.add_permission(self, label, aws_account_id, action_name)
+ return self.connection.add_permission(self, label, aws_account_id,
+ action_name)
def remove_permission(self, label):
"""
Remove a permission from a queue.
:type label: str or unicode
- :param label: The unique label associated with the permission being removed.
+ :param label: The unique label associated with the permission
+ being removed.
:rtype: bool
:return: True if successful, False otherwise.
@@ -175,7 +179,7 @@ class Queue:
def read(self, visibility_timeout=None):
"""
Read a single message from the queue.
-
+
:type visibility_timeout: int
:param visibility_timeout: The timeout for this message in seconds
@@ -198,7 +202,9 @@ class Queue:
:rtype: :class:`boto.sqs.message.Message`
:return: The :class:`boto.sqs.message.Message` object that was written.
"""
- new_msg = self.connection.send_message(self, message.get_body_encoded(), delay_seconds)
+ new_msg = self.connection.send_message(self,
+ message.get_body_encoded(),
+ delay_seconds)
message.id = new_msg.id
message.md5 = new_msg.md5
return message
@@ -224,25 +230,30 @@ class Queue:
Get a variable number of messages.
:type num_messages: int
- :param num_messages: The maximum number of messages to read from the queue.
-
+ :param num_messages: The maximum number of messages to read
+ from the queue.
+
:type visibility_timeout: int
:param visibility_timeout: The VisibilityTimeout for the messages read.
:type attributes: str
- :param attributes: The name of additional attribute to return with response
- or All if you want all attributes. The default is to
- return no additional attributes. Valid values:
- All
- SenderId
- SentTimestamp
- ApproximateReceiveCount
- ApproximateFirstReceiveTimestamp
-
+
+ :param attributes: The name of additional attribute to return
+ with response or All if you want all attributes. The
+ default is to return no additional attributes. Valid
+ values:
+
+ * All
+ * SenderId
+ * SentTimestamp
+ * ApproximateReceiveCount
+ * ApproximateFirstReceiveTimestamp
+
:rtype: list
:return: A list of :class:`boto.sqs.message.Message` objects.
"""
- return self.connection.receive_message(self, number_messages=num_messages,
+ return self.connection.receive_message(self,
+ number_messages=num_messages,
visibility_timeout=visibility_timeout,
attributes=attributes)
@@ -356,9 +367,9 @@ class Queue:
"""
Read all messages from the queue and persist them to S3.
Messages are stored in the S3 bucket using a naming scheme of::
-
+
<queue_id>/<message_id>
-
+
Messages are deleted from the queue after being saved to S3.
Returns the number of messages saved.
"""
@@ -389,7 +400,9 @@ class Queue:
return n
def load_from_file(self, fp, sep='\n'):
- """Utility function to load messages from a file-like object to a queue"""
+ """
+ Utility function to load messages from a file-like object to a queue
+ """
n = 0
body = ''
l = fp.readline()
@@ -406,7 +419,9 @@ class Queue:
return n
def load_from_filename(self, file_name, sep='\n'):
- """Utility function to load messages from a local filename to a queue"""
+ """
+ Utility function to load messages from a local filename to a queue
+ """
fp = open(file_name, 'rb')
n = self.load_from_file(fp, sep)
fp.close()
@@ -414,4 +429,3 @@ class Queue:
# for backward compatibility
load = load_from_filename
-
diff --git a/boto/sqs/regioninfo.py b/boto/sqs/regioninfo.py
index 66d67336..78ac648a 100644
--- a/boto/sqs/regioninfo.py
+++ b/boto/sqs/regioninfo.py
@@ -16,7 +16,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -24,6 +24,7 @@
from boto.regioninfo import RegionInfo
+
class SQSRegionInfo(RegionInfo):
def __init__(self, connection=None, name=None, endpoint=None):
diff --git a/boto/sts/__init__.py b/boto/sts/__init__.py
index 0d02c4ac..30064914 100644
--- a/boto/sts/__init__.py
+++ b/boto/sts/__init__.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -23,6 +23,7 @@
from .connection import STSConnection
from boto.regioninfo import RegionInfo
+
def regions():
"""
Get all available regions for the STS service.
@@ -35,14 +36,15 @@ def regions():
connection_cls=STSConnection)
]
+
def connect_to_region(region_name, **kw_params):
"""
- Given a valid region name, return a
+ Given a valid region name, return a
:class:`boto.sts.connection.STSConnection`.
:type: str
:param region_name: The name of the region to connect to.
-
+
:rtype: :class:`boto.sts.connection.STSConnection` or ``None``
:return: A connection to the given region, or None if an invalid region
name is given
@@ -52,6 +54,7 @@ def connect_to_region(region_name, **kw_params):
return region.connect(**kw_params)
return None
+
def get_region(region_name, **kw_params):
"""
Find and return a :class:`boto.regioninfo.RegionInfo` object
diff --git a/boto/sts/connection.py b/boto/sts/connection.py
index c39fef81..37d85ecc 100644
--- a/boto/sts/connection.py
+++ b/boto/sts/connection.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -30,6 +30,7 @@ import threading
_session_token_cache = {}
+
class STSConnection(AWSQueryConnection):
DefaultRegionName = 'us-east-1'
@@ -108,13 +109,13 @@ class STSConnection(AWSQueryConnection):
_session_token_cache[token_key] = token
self._mutex.release()
return token
-
+
def get_federation_token(self, name, duration=None, policy=None):
"""
:type name: str
:param name: The name of the Federated user associated with
the credentials.
-
+
:type duration: int
:param duration: The number of seconds the credentials should
remain valid.
@@ -123,12 +124,10 @@ class STSConnection(AWSQueryConnection):
:param policy: A JSON policy to associate with these credentials.
"""
- params = {'Name' : name}
+ params = {'Name': name}
if duration:
params['DurationSeconds'] = duration
if policy:
params['Policy'] = policy
return self.get_object('GetFederationToken', params,
FederationToken, verb='POST')
-
-
diff --git a/boto/sts/credentials.py b/boto/sts/credentials.py
index d6ecb43e..0e2e5709 100644
--- a/boto/sts/credentials.py
+++ b/boto/sts/credentials.py
@@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -136,7 +136,8 @@ class Credentials(object):
ts = boto.utils.parse_ts(self.expiration)
delta = ts - now
return delta.total_seconds() <= 0
-
+
+
class FederationToken(object):
"""
:ivar credentials: A Credentials object containing the credentials.
@@ -171,4 +172,3 @@ class FederationToken(object):
self.request_id = value
else:
pass
-
diff --git a/boto/swf/__init__.py b/boto/swf/__init__.py
index 72eca001..34abc1dd 100644
--- a/boto/swf/__init__.py
+++ b/boto/swf/__init__.py
@@ -16,7 +16,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,10 +25,11 @@
from boto.ec2.regioninfo import RegionInfo
import boto.swf.layer1
+
def regions():
"""
Get all available regions for the Amazon Simple Workflow service.
-
+
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
@@ -38,9 +39,9 @@ def regions():
connection_cls=boto.swf.layer1.Layer1),
]
+
def connect_to_region(region_name, **kw_params):
for region in regions():
if region.name == region_name:
return region.connect(**kw_params)
return None
-
diff --git a/boto/swf/layer1.py b/boto/swf/layer1.py
index fc422f0d..ae29dd01 100644
--- a/boto/swf/layer1.py
+++ b/boto/swf/layer1.py
@@ -16,7 +16,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -34,7 +34,8 @@ import time
# value of Debug to be 2
#
#boto.set_stream_logger('dynamodb')
-Debug=0
+Debug = 0
+
class Layer1(AWSAuthConnection):
"""
@@ -46,7 +47,7 @@ class Layer1(AWSAuthConnection):
ServiceName = 'com.amazonaws.swf.service.model.SimpleWorkflowService'
"""The name of the Service"""
-
+
ResponseError = DynamoDBResponseError
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
@@ -89,7 +90,7 @@ class Layer1(AWSAuthConnection):
return None
# Actions related to Activities
-
+
def poll_for_activity_task(self, domain, task_list, identity=None):
"""
Used by workers to get an ActivityTask from the specified
@@ -388,7 +389,7 @@ class Layer1(AWSAuthConnection):
when it receives an execution history with this event.
* ABANDON: no action will be taken. The child executions
will continue to run.
-
+
:type execution_start_to_close_timeout: string
:param execution_start_to_close_timeout: The total duration for
this workflow execution. This overrides the
@@ -501,14 +502,14 @@ class Layer1(AWSAuthConnection):
starting the execution. The supported child policies are:
* TERMINATE: the child executions will be terminated.
-
+
* REQUEST_CANCEL: a request to cancel will be attempted
for each child execution by recording a
WorkflowExecutionCancelRequested event in its
history. It is up to the decider to take appropriate
actions when it receives an execution history with this
event.
-
+
* ABANDON: no action will be taken. The child executions
will continue to run.
@@ -608,7 +609,7 @@ class Layer1(AWSAuthConnection):
:raises: TypeAlreadyExistsFault, LimitExceededFault,
UnknownResourceFault, OperationNotPermittedFault
"""
- data = {'domain': domain, 'name': name,'version': version}
+ data = {'domain': domain, 'name': name, 'version': version}
if task_list:
data['taskList'] = {'name': task_list}
if default_task_heartbeat_timeout:
@@ -675,7 +676,7 @@ class Layer1(AWSAuthConnection):
Action or StartChildWorkflowExecution Decision.
:type default_child_policy: string
-
+
:param default_child_policy: If set, specifies the default
policy to use for the child workflow executions when a
workflow execution of this type is terminated, by calling the
@@ -686,14 +687,14 @@ class Layer1(AWSAuthConnection):
child policies are:
* TERMINATE: the child executions will be terminated.
-
+
* REQUEST_CANCEL: a request to cancel will be attempted
for each child execution by recording a
WorkflowExecutionCancelRequested event in its
history. It is up to the decider to take appropriate
actions when it receives an execution history with this
event.
-
+
* ABANDON: no action will be taken. The child executions
will continue to run.no docs
@@ -770,7 +771,7 @@ class Layer1(AWSAuthConnection):
:param name: Name of the domain to register. The name must be unique.
:type workflow_execution_retention_period_in_days: string
-
+
:param workflow_execution_retention_period_in_days: Specifies
the duration *in days* for which the record (including the
history) of workflow executions in this domain should be kept
@@ -855,9 +856,9 @@ class Layer1(AWSAuthConnection):
NextResultToken was returned, the results have more than one
page. To get the next page of results, repeat the call with
the nextPageToken and keep all other arguments unchanged.
-
+
:type reverse_order: boolean
-
+
:param reverse_order: When set to true, returns the results in
reverse order. By default the results are returned in
ascending alphabetical order of the name of the activity
@@ -1115,7 +1116,11 @@ class Layer1(AWSAuthConnection):
json_input = compat.json.dumps(data)
return self.make_request('CountOpenWorkflowExecutions', json_input)
- def list_open_workflow_executions(self, domain, name, oldest_date, tag, workflow_id, latest_date=None, maximum_page_size=None, next_page_token=None, reverse_order=None, version=None):
+ def list_open_workflow_executions(self, domain, name, oldest_date,
+ tag, workflow_id, latest_date=None,
+ maximum_page_size=None,
+ next_page_token=None,
+ reverse_order=None, version=None):
"""
No documentation supplied.
@@ -1151,7 +1156,9 @@ class Layer1(AWSAuthConnection):
:raises: #UnknownResourceFault, #OperationNotPermittedFault
"""
- data = {'domain': domain, 'name': name, 'oldestDate': oldest_date, 'tag': tag, 'workflowId': workflow_id}
+ data = {'domain': domain, 'name': name,
+ 'oldestDate': oldest_date, 'tag': tag,
+ 'workflowId': workflow_id}
if latest_date:
data['latestDate'] = latest_date
if maximum_page_size:
@@ -1470,7 +1477,3 @@ class Layer1(AWSAuthConnection):
data = {'domain': domain, 'taskList': {'name': task_list}}
json_input = compat.json.dumps(data)
return self.make_request('CountPendingActivityTasks', json_input)
-
-
-
-
diff --git a/boto/vpc/__init__.py b/boto/vpc/__init__.py
index ae55a26e..6dbc3995 100644
--- a/boto/vpc/__init__.py
+++ b/boto/vpc/__init__.py
@@ -34,6 +34,7 @@ from boto.vpc.dhcpoptions import DhcpOptions
from boto.vpc.subnet import Subnet
from boto.vpc.vpnconnection import VpnConnection
+
class VPCConnection(EC2Connection):
# VPC methods
@@ -81,7 +82,7 @@ class VPCConnection(EC2Connection):
:rtype: The newly created VPC
:return: A :class:`boto.vpc.vpc.VPC` object
"""
- params = {'CidrBlock' : cidr_block}
+ params = {'CidrBlock': cidr_block}
return self.get_object('CreateVpc', params, VPC)
def delete_vpc(self, vpc_id):
@@ -122,7 +123,8 @@ class VPCConnection(EC2Connection):
self.build_list_params(params, route_table_ids, "RouteTableId")
if filters:
self.build_filter_params(params, dict(filters))
- return self.get_list('DescribeRouteTables', params, [('item', RouteTable)])
+ return self.get_list('DescribeRouteTables', params,
+ [('item', RouteTable)])
def associate_route_table(self, route_table_id, subnet_id):
"""
@@ -157,7 +159,7 @@ class VPCConnection(EC2Connection):
:rtype: bool
:return: True if successful
"""
- params = { 'AssociationId': association_id }
+ params = {'AssociationId': association_id}
return self.get_status('DisassociateRouteTable', params)
def create_route_table(self, vpc_id):
@@ -170,7 +172,7 @@ class VPCConnection(EC2Connection):
:rtype: The newly created route table
:return: A :class:`boto.vpc.routetable.RouteTable` object
"""
- params = { 'VpcId': vpc_id }
+ params = {'VpcId': vpc_id}
return self.get_object('CreateRouteTable', params, RouteTable)
def delete_route_table(self, route_table_id):
@@ -183,10 +185,11 @@ class VPCConnection(EC2Connection):
:rtype: bool
:return: True if successful
"""
- params = { 'RouteTableId': route_table_id }
+ params = {'RouteTableId': route_table_id}
return self.get_status('DeleteRouteTable', params)
- def create_route(self, route_table_id, destination_cidr_block, gateway_id=None, instance_id=None):
+ def create_route(self, route_table_id, destination_cidr_block,
+ gateway_id=None, instance_id=None):
"""
Creates a new route in the route table within a VPC. The route's target
can be either a gateway attached to the VPC or a NAT instance in the
@@ -243,13 +246,16 @@ class VPCConnection(EC2Connection):
# Internet Gateways
- def get_all_internet_gateways(self, internet_gateway_ids=None, filters=None):
+ def get_all_internet_gateways(self, internet_gateway_ids=None,
+ filters=None):
"""
- Get a list of internet gateways. You can filter results to return information
- about only those gateways that you're interested in.
+ Get a list of internet gateways. You can filter results to
+ return information about only those gateways that you're
+ interested in.
:type internet_gateway_ids: list
- :param internet_gateway_ids: A list of strings with the desired gateway IDs.
+ :param internet_gateway_ids: A list of strings with the
+ desired gateway IDs.
:type filters: list of tuples
:param filters: A list of tuples containing filters. Each tuple
@@ -258,11 +264,13 @@ class VPCConnection(EC2Connection):
params = {}
if internet_gateway_ids:
- self.build_list_params(params, internet_gateway_ids, 'InternetGatewayId')
+ self.build_list_params(params, internet_gateway_ids,
+ 'InternetGatewayId')
if filters:
self.build_filter_params(params, dict(filters))
- return self.get_list('DescribeInternetGateways', params, [('item', InternetGateway)])
+ return self.get_list('DescribeInternetGateways', params,
+ [('item', InternetGateway)])
def create_internet_gateway(self):
"""
@@ -283,7 +291,7 @@ class VPCConnection(EC2Connection):
:rtype: Bool
:return: True if successful
"""
- params = { 'InternetGatewayId': internet_gateway_id }
+ params = {'InternetGatewayId': internet_gateway_id}
return self.get_status('DeleteInternetGateway', params)
def attach_internet_gateway(self, internet_gateway_id, vpc_id):
@@ -328,47 +336,55 @@ class VPCConnection(EC2Connection):
# Customer Gateways
- def get_all_customer_gateways(self, customer_gateway_ids=None, filters=None):
+ def get_all_customer_gateways(self, customer_gateway_ids=None,
+ filters=None):
"""
- Retrieve information about your CustomerGateways. You can filter results to
- return information only about those CustomerGateways that match your search
- parameters. Otherwise, all CustomerGateways associated with your account
+ Retrieve information about your CustomerGateways. You can
+ filter results to return information only about those
+ CustomerGateways that match your search parameters.
+ Otherwise, all CustomerGateways associated with your account
are returned.
:type customer_gateway_ids: list
- :param customer_gateway_ids: A list of strings with the desired CustomerGateway ID's
+ :param customer_gateway_ids: A list of strings with the desired
+ CustomerGateway ID's
:type filters: list of tuples
:param filters: A list of tuples containing filters. Each tuple
- consists of a filter key and a filter value.
- Possible filter keys are:
+ consists of a filter key and a filter value.
+ Possible filter keys are:
- - *state*, the state of the CustomerGateway
- (pending,available,deleting,deleted)
- - *type*, the type of customer gateway (ipsec.1)
- - *ipAddress* the IP address of customer gateway's
- internet-routable external inteface
+ * state - the state of the CustomerGateway
+ (pending,available,deleting,deleted)
+
+ * type - the type of customer gateway (ipsec.1)
+
+ * ipAddress - the IP address of customer gateway's
+ internet-routable external inteface
:rtype: list
:return: A list of :class:`boto.vpc.customergateway.CustomerGateway`
"""
params = {}
if customer_gateway_ids:
- self.build_list_params(params, customer_gateway_ids, 'CustomerGatewayId')
+ self.build_list_params(params, customer_gateway_ids,
+ 'CustomerGatewayId')
if filters:
i = 1
for filter in filters:
params[('Filter.%d.Name' % i)] = filter[0]
params[('Filter.%d.Value.1')] = filter[1]
i += 1
- return self.get_list('DescribeCustomerGateways', params, [('item', CustomerGateway)])
+ return self.get_list('DescribeCustomerGateways', params,
+ [('item', CustomerGateway)])
def create_customer_gateway(self, type, ip_address, bgp_asn):
"""
Create a new Customer Gateway
:type type: str
- :param type: Type of VPN Connection. Only valid valid currently is 'ipsec.1'
+ :param type: Type of VPN Connection. Only valid valid currently
+ is 'ipsec.1'
:type ip_address: str
:param ip_address: Internet-routable IP address for customer's gateway.
@@ -381,17 +397,19 @@ class VPCConnection(EC2Connection):
:rtype: The newly created CustomerGateway
:return: A :class:`boto.vpc.customergateway.CustomerGateway` object
"""
- params = {'Type' : type,
- 'IpAddress' : ip_address,
- 'BgpAsn' : bgp_asn}
- return self.get_object('CreateCustomerGateway', params, CustomerGateway)
+ params = {'Type': type,
+ 'IpAddress': ip_address,
+ 'BgpAsn': bgp_asn}
+ return self.get_object('CreateCustomerGateway', params,
+ CustomerGateway)
def delete_customer_gateway(self, customer_gateway_id):
"""
Delete a Customer Gateway.
:type customer_gateway_id: str
- :param customer_gateway_id: The ID of the customer_gateway to be deleted.
+ :param customer_gateway_id: The ID of the customer_gateway
+ to be deleted.
:rtype: bool
:return: True if successful
@@ -409,7 +427,8 @@ class VPCConnection(EC2Connection):
are returned.
:type vpn_gateway_ids: list
- :param vpn_gateway_ids: A list of strings with the desired VpnGateway ID's
+ :param vpn_gateway_ids: A list of strings with the desired
+ VpnGateway ID's
:type filters: list of tuples
:param filters: A list of tuples containing filters. Each tuple
@@ -434,22 +453,25 @@ class VPCConnection(EC2Connection):
params[('Filter.%d.Name' % i)] = filter[0]
params[('Filter.%d.Value.1')] = filter[1]
i += 1
- return self.get_list('DescribeVpnGateways', params, [('item', VpnGateway)])
+ return self.get_list('DescribeVpnGateways', params,
+ [('item', VpnGateway)])
def create_vpn_gateway(self, type, availability_zone=None):
"""
Create a new Vpn Gateway
:type type: str
- :param type: Type of VPN Connection. Only valid valid currently is 'ipsec.1'
+ :param type: Type of VPN Connection. Only valid valid
+ currently is 'ipsec.1'
:type availability_zone: str
- :param availability_zone: The Availability Zone where you want the VPN gateway.
+ :param availability_zone: The Availability Zone where you want
+ the VPN gateway.
:rtype: The newly created VpnGateway
:return: A :class:`boto.vpc.vpngateway.VpnGateway` object
"""
- params = {'Type' : type}
+ params = {'Type': type}
if availability_zone:
params['AvailabilityZone'] = availability_zone
return self.get_object('CreateVpnGateway', params, VpnGateway)
@@ -481,7 +503,7 @@ class VPCConnection(EC2Connection):
:return: a :class:`boto.vpc.vpngateway.Attachment`
"""
params = {'VpnGatewayId': vpn_gateway_id,
- 'VpcId' : vpc_id}
+ 'VpcId': vpc_id}
return self.get_object('AttachVpnGateway', params, Attachment)
# Subnets
@@ -539,8 +561,8 @@ class VPCConnection(EC2Connection):
:rtype: The newly created Subnet
:return: A :class:`boto.vpc.customergateway.Subnet` object
"""
- params = {'VpcId' : vpc_id,
- 'CidrBlock' : cidr_block}
+ params = {'VpcId': vpc_id,
+ 'CidrBlock': cidr_block}
if availability_zone:
params['AvailabilityZone'] = availability_zone
return self.get_object('CreateSubnet', params, Subnet)
@@ -558,7 +580,6 @@ class VPCConnection(EC2Connection):
params = {'SubnetId': subnet_id}
return self.get_status('DeleteSubnet', params)
-
# DHCP Options
def get_all_dhcp_options(self, dhcp_options_ids=None):
@@ -566,7 +587,8 @@ class VPCConnection(EC2Connection):
Retrieve information about your DhcpOptions.
:type dhcp_options_ids: list
- :param dhcp_options_ids: A list of strings with the desired DhcpOption ID's
+ :param dhcp_options_ids: A list of strings with the desired
+ DhcpOption ID's
:rtype: list
:return: A list of :class:`boto.vpc.dhcpoptions.DhcpOptions`
@@ -574,7 +596,8 @@ class VPCConnection(EC2Connection):
params = {}
if dhcp_options_ids:
self.build_list_params(params, dhcp_options_ids, 'DhcpOptionsId')
- return self.get_list('DescribeDhcpOptions', params, [('item', DhcpOptions)])
+ return self.get_list('DescribeDhcpOptions', params,
+ [('item', DhcpOptions)])
def create_dhcp_options(self, vpc_id, cidr_block, availability_zone=None):
"""
@@ -592,8 +615,8 @@ class VPCConnection(EC2Connection):
:rtype: The newly created DhcpOption
:return: A :class:`boto.vpc.customergateway.DhcpOption` object
"""
- params = {'VpcId' : vpc_id,
- 'CidrBlock' : cidr_block}
+ params = {'VpcId': vpc_id,
+ 'CidrBlock': cidr_block}
if availability_zone:
params['AvailabilityZone'] = availability_zone
return self.get_object('CreateDhcpOption', params, DhcpOptions)
@@ -625,47 +648,54 @@ class VPCConnection(EC2Connection):
:return: True if successful
"""
params = {'DhcpOptionsId': dhcp_options_id,
- 'VpcId' : vpc_id}
+ 'VpcId': vpc_id}
return self.get_status('AssociateDhcpOptions', params)
# VPN Connection
def get_all_vpn_connections(self, vpn_connection_ids=None, filters=None):
"""
- Retrieve information about your VPN_CONNECTIONs. You can filter results to
- return information only about those VPN_CONNECTIONs that match your search
- parameters. Otherwise, all VPN_CONNECTIONs associated with your account
- are returned.
+ Retrieve information about your VPN_CONNECTIONs. You can
+ filter results to return information only about those
+ VPN_CONNECTIONs that match your search parameters. Otherwise,
+ all VPN_CONNECTIONs associated with your account are returned.
:type vpn_connection_ids: list
- :param vpn_connection_ids: A list of strings with the desired VPN_CONNECTION ID's
+ :param vpn_connection_ids: A list of strings with the desired
+ VPN_CONNECTION ID's
:type filters: list of tuples
:param filters: A list of tuples containing filters. Each tuple
- consists of a filter key and a filter value.
- Possible filter keys are:
+ consists of a filter key and a filter value.
+ Possible filter keys are:
+
+ * state - the state of the VPN_CONNECTION
+ pending,available,deleting,deleted
+
+ * type - the type of connection, currently 'ipsec.1'
- - *state*, the state of the VPN_CONNECTION
- pending,available,deleting,deleted
- - *type*, the type of connection, currently 'ipsec.1'
- - *customerGatewayId*, the ID of the customer gateway
- associated with the VPN
- - *vpnGatewayId*, the ID of the VPN gateway associated
- with the VPN connection
+ * customerGatewayId - the ID of the customer gateway
+ associated with the VPN
+
+ * vpnGatewayId - the ID of the VPN gateway associated
+ with the VPN connection
:rtype: list
- :return: A list of :class:`boto.vpn_connection.vpnconnection.VpnConnection`
+ :return: A list of
+ :class:`boto.vpn_connection.vpnconnection.VpnConnection`
"""
params = {}
if vpn_connection_ids:
- self.build_list_params(params, vpn_connection_ids, 'Vpn_ConnectionId')
+ self.build_list_params(params, vpn_connection_ids,
+ 'Vpn_ConnectionId')
if filters:
i = 1
for filter in filters:
params[('Filter.%d.Name' % i)] = filter[0]
params[('Filter.%d.Value.1')] = filter[1]
i += 1
- return self.get_list('DescribeVpnConnections', params, [('item', VpnConnection)])
+ return self.get_list('DescribeVpnConnections', params,
+ [('item', VpnConnection)])
def create_vpn_connection(self, type, customer_gateway_id, vpn_gateway_id):
"""
@@ -684,9 +714,9 @@ class VPCConnection(EC2Connection):
:rtype: The newly created VpnConnection
:return: A :class:`boto.vpc.vpnconnection.VpnConnection` object
"""
- params = {'Type' : type,
- 'CustomerGatewayId' : customer_gateway_id,
- 'VpnGatewayId' : vpn_gateway_id}
+ params = {'Type': type,
+ 'CustomerGatewayId': customer_gateway_id,
+ 'VpnGatewayId': vpn_gateway_id}
return self.get_object('CreateVpnConnection', params, VpnConnection)
def delete_vpn_connection(self, vpn_connection_id):
@@ -701,5 +731,3 @@ class VPCConnection(EC2Connection):
"""
params = {'VpnConnectionId': vpn_connection_id}
return self.get_status('DeleteVpnConnection', params)
-
-
diff --git a/boto/vpc/customergateway.py b/boto/vpc/customergateway.py
index 959d01fb..cc450bd8 100644
--- a/boto/vpc/customergateway.py
+++ b/boto/vpc/customergateway.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@ Represents a Customer Gateway
from boto.ec2.ec2object import TaggedEC2Object
+
class CustomerGateway(TaggedEC2Object):
def __init__(self, connection=None):
@@ -37,7 +38,7 @@ class CustomerGateway(TaggedEC2Object):
def __repr__(self):
return 'CustomerGateway:%s' % self.id
-
+
def endElement(self, name, value, connection):
if name == 'customerGatewayId':
self.id = value
@@ -51,4 +52,3 @@ class CustomerGateway(TaggedEC2Object):
self.bgp_asn = value
else:
setattr(self, name, value)
-
diff --git a/boto/vpc/dhcpoptions.py b/boto/vpc/dhcpoptions.py
index 74846838..3c11c023 100644
--- a/boto/vpc/dhcpoptions.py
+++ b/boto/vpc/dhcpoptions.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@ Represents a DHCP Options set
from boto.ec2.ec2object import TaggedEC2Object
+
class DhcpValueSet(list):
def startElement(self, name, attrs, connection):
@@ -33,7 +34,8 @@ class DhcpValueSet(list):
def endElement(self, name, value, connection):
if name == 'value':
self.append(value)
-
+
+
class DhcpConfigSet(dict):
def startElement(self, name, attrs, connection):
@@ -45,7 +47,8 @@ class DhcpConfigSet(dict):
def endElement(self, name, value, connection):
if name == 'key':
self._name = value
-
+
+
class DhcpOptions(TaggedEC2Object):
def __init__(self, connection=None):
@@ -55,7 +58,7 @@ class DhcpOptions(TaggedEC2Object):
def __repr__(self):
return 'DhcpOptions:%s' % self.id
-
+
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
if retval is not None:
@@ -69,4 +72,3 @@ class DhcpOptions(TaggedEC2Object):
self.id = value
else:
setattr(self, name, value)
-
diff --git a/boto/vpc/internetgateway.py b/boto/vpc/internetgateway.py
index 011fdee1..5a166298 100644
--- a/boto/vpc/internetgateway.py
+++ b/boto/vpc/internetgateway.py
@@ -26,6 +26,7 @@ Represents an Internet Gateway
from boto.ec2.ec2object import TaggedEC2Object
from boto.resultset import ResultSet
+
class InternetGateway(TaggedEC2Object):
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
@@ -36,7 +37,8 @@ class InternetGateway(TaggedEC2Object):
return 'InternetGateway:%s' % self.id
def startElement(self, name, attrs, connection):
- result = super(InternetGateway, self).startElement(name, attrs, connection)
+ result = super(InternetGateway, self).startElement(name, attrs,
+ connection)
if result is not None:
# Parent found an interested element, just return it
@@ -54,6 +56,7 @@ class InternetGateway(TaggedEC2Object):
else:
setattr(self, name, value)
+
class InternetGatewayAttachment(object):
def __init__(self, connection=None):
self.vpc_id = None
diff --git a/boto/vpc/routetable.py b/boto/vpc/routetable.py
index b3f00553..2abbef71 100644
--- a/boto/vpc/routetable.py
+++ b/boto/vpc/routetable.py
@@ -26,6 +26,7 @@ Represents a Route Table
from boto.ec2.ec2object import TaggedEC2Object
from boto.resultset import ResultSet
+
class RouteTable(TaggedEC2Object):
def __init__(self, connection=None):
@@ -62,6 +63,7 @@ class RouteTable(TaggedEC2Object):
else:
setattr(self, name, value)
+
class Route(object):
def __init__(self, connection=None):
self.destination_cidr_block = None
@@ -85,6 +87,7 @@ class Route(object):
elif name == 'state':
self.state = value
+
class RouteAssociation(object):
def __init__(self, connection=None):
self.id = None
diff --git a/boto/vpc/subnet.py b/boto/vpc/subnet.py
index f87d72c2..df1b2262 100644
--- a/boto/vpc/subnet.py
+++ b/boto/vpc/subnet.py
@@ -25,6 +25,7 @@ Represents a Subnet
from boto.ec2.ec2object import TaggedEC2Object
+
class Subnet(TaggedEC2Object):
def __init__(self, connection=None):
@@ -54,4 +55,3 @@ class Subnet(TaggedEC2Object):
self.availability_zone = value
else:
setattr(self, name, value)
-
diff --git a/boto/vpc/vpc.py b/boto/vpc/vpc.py
index 0539acd8..9793530b 100644
--- a/boto/vpc/vpc.py
+++ b/boto/vpc/vpc.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@ Represents a Virtual Private Cloud.
from boto.ec2.ec2object import TaggedEC2Object
+
class VPC(TaggedEC2Object):
def __init__(self, connection=None):
@@ -36,7 +37,7 @@ class VPC(TaggedEC2Object):
def __repr__(self):
return 'VPC:%s' % self.id
-
+
def endElement(self, name, value, connection):
if name == 'vpcId':
self.id = value
@@ -51,4 +52,3 @@ class VPC(TaggedEC2Object):
def delete(self):
return self.connection.delete_vpc(self.id)
-
diff --git a/boto/vpc/vpnconnection.py b/boto/vpc/vpnconnection.py
index 2e089e73..982393e5 100644
--- a/boto/vpc/vpnconnection.py
+++ b/boto/vpc/vpnconnection.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@ Represents a VPN Connectionn
from boto.ec2.ec2object import EC2Object
+
class VpnConnection(EC2Object):
def __init__(self, connection=None):
@@ -38,7 +39,7 @@ class VpnConnection(EC2Object):
def __repr__(self):
return 'VpnConnection:%s' % self.id
-
+
def endElement(self, name, value, connection):
if name == 'vpnConnectionId':
self.id = value
@@ -57,4 +58,3 @@ class VpnConnection(EC2Object):
def delete(self):
return self.connection.delete_vpn_connection(self.id)
-
diff --git a/boto/vpc/vpngateway.py b/boto/vpc/vpngateway.py
index 83b912ef..6c9faa9c 100644
--- a/boto/vpc/vpngateway.py
+++ b/boto/vpc/vpngateway.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -25,6 +25,7 @@ Represents a Vpn Gateway
from boto.ec2.ec2object import TaggedEC2Object
+
class Attachment(object):
def __init__(self, connection=None):
@@ -33,7 +34,7 @@ class Attachment(object):
def startElement(self, name, attrs, connection):
pass
-
+
def endElement(self, name, value, connection):
if name == 'vpcId':
self.vpc_id = value
@@ -41,7 +42,8 @@ class Attachment(object):
self.state = value
else:
setattr(self, name, value)
-
+
+
class VpnGateway(TaggedEC2Object):
def __init__(self, connection=None):
@@ -63,7 +65,7 @@ class VpnGateway(TaggedEC2Object):
att = Attachment()
self.attachments.append(att)
return att
-
+
def endElement(self, name, value, connection):
if name == 'vpnGatewayId':
self.id = value
@@ -80,4 +82,3 @@ class VpnGateway(TaggedEC2Object):
def attach(self, vpc_id):
return self.connection.attach_vpn_gateway(self.id, vpc_id)
-