Skip to content

Commit

Permalink
Merge branch 'release-2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
garnaat committed May 16, 2012
2 parents 911f42b + 6588ea2 commit 1aa1133
Show file tree
Hide file tree
Showing 95 changed files with 7,715 additions and 1,322 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include boto/cacerts/cacerts.txt
include README.markdown
include README.rst
include Changelog.rst
include boto/file/README
include .gitignore
Expand Down
73 changes: 0 additions & 73 deletions README.markdown

This file was deleted.

100 changes: 100 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
####
boto
####
boto 2.4.0
15-May-2012

************
Introduction
************

Boto is a Python package that provides interfaces to Amazon Web Services.
At the moment, boto supports:

* Simple Storage Service (S3)
* SimpleQueue Service (SQS)
* Elastic Compute Cloud (EC2)
* Mechanical Turk
* SimpleDB
* CloudFront
* CloudWatch
* AutoScale
* Elastic Load Balancer (ELB)
* Virtual Private Cloud (VPC)
* Elastic Map Reduce (EMR)
* Relational Data Service (RDS)
* Simple Notification Server (SNS)
* Google Storage
* Identity and Access Management (IAM)
* Route53 DNS Service (route53)
* Simple Email Service (SES)
* Flexible Payment Service (FPS)
* CloudFormation
* Amazon DynamoDB
* Amazon SimpleWorkflow
* CloudSearch
* Marketplace Web Services

The goal of boto is to support the full breadth and depth of Amazon
Web Services. In addition, boto provides support for other public
services such as Google Storage in addition to private cloud systems
like Eucalyptus, OpenStack and Open Nebula.

Boto is developed mainly using Python 2.6.6 and Python 2.7.1 on Mac OSX
and Ubuntu Maverick. It is known to work on other Linux distributions
and on Windows. Boto requires no additional libraries or packages
other than those that are distributed with Python. Efforts are made
to keep boto compatible with Python 2.5.x but no guarantees are made.

*********************************
Special Note for Python 3.x Users
*********************************

If you are interested in trying out boto with Python 3.x, check out the
`neo`_ branch. This is under active development and the goal is a version
of boto that works in Python 2.6, 2.7, and 3.x. Not everything is working
just yet but many things are and it's worth a look if you are an active
Python 3.x user.

***************************
Finding Out More About Boto
***************************

The main source code repository for boto can be found on `github.com`_.
The boto project uses the `gitflow`_ model for branching.

`Online documentation`_ is also available. The online documentation includes
full API documentation as well as Getting Started Guides for many of the boto
modules.

Boto releases can be found on the `Python Cheese Shop`_.

Join our IRC channel `#boto` on FreeNode.
Webchat IRC channel: http://webchat.freenode.net/?channels=boto

*************************
Getting Started with Boto
*************************

Your credentials can be passed into the methods that create
connections. Alternatively, boto will check for the existance of the
following environment variables to ascertain your credentials:

**AWS_ACCESS_KEY_ID** - Your AWS Access Key ID

**AWS_SECRET_ACCESS_KEY** - Your AWS Secret Access Key

Credentials and other boto-related settings can also be stored in a
boto config file. See `this`_ for details.

Copyright (c) 2006-2012 Mitch Garnaat <[email protected]>
Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
All rights reserved.

.. _github.com: http://github.com/boto/boto
.. _Online documentation: http://docs.pythonboto.org
.. _Python Cheese Shop: http://pypi.python.org/pypi/boto
.. _this: http://code.google.com/p/boto/wiki/BotoConfig
.. _gitflow: http://nvie.com/posts/a-successful-git-branching-model/
.. _neo: https://github.com/boto/boto/tree/neo
4 changes: 2 additions & 2 deletions bin/s3multiput
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def main():
else:
upload(bucket_name, aws_access_key_id,
aws_secret_access_key, fullpath, key_name,
reduced, debug, cb, num_cb)
reduced, debug, cb, num_cb, grant or 'private')
total += 1

# upload a single file
Expand All @@ -311,7 +311,7 @@ def main():
else:
upload(bucket_name, aws_access_key_id,
aws_secret_access_key, path, key_name,
reduced, debug, cb, num_cb)
reduced, debug, cb, num_cb, grant or 'private')

if __name__ == "__main__":
main()
25 changes: 22 additions & 3 deletions boto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import urlparse
from boto.exception import InvalidUriError

__version__ = '2.3.0'
__version__ = '2.4.0'
Version = __version__ # for backware compatibility

UserAgent = 'Boto/%s (%s)' % (__version__, sys.platform)
Expand Down Expand Up @@ -371,7 +371,7 @@ def connect_euca(host=None, aws_access_key_id=None, aws_secret_access_key=None,
region=reg, port=port, path=path,
is_secure=is_secure, **kwargs)

def connect_ec2_endpoint(url, aws_access_key_id=None, aws_secret_access_key=None,
def connect_ec2_endpoint(url, aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
Connect to an EC2 Api endpoint. Additional arguments are passed
Expand Down Expand Up @@ -437,7 +437,7 @@ def connect_walrus(host=None, aws_access_key_id=None, aws_secret_access_key=None
None)
if not host:
host = config.get('Boto', 'walrus_host', None)

return S3Connection(aws_access_key_id, aws_secret_access_key,
host=host, port=port, path=path,
calling_format=OrdinaryCallingFormat(),
Expand Down Expand Up @@ -535,6 +535,25 @@ def connect_swf(aws_access_key_id=None,
from boto.swf.layer1 import Layer1
return Layer1(aws_access_key_id, aws_secret_access_key, **kwargs)


def connect_cloudsearch(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.autoscale.CloudSearchConnection`
:return: A connection to Amazon's CloudSearch service
"""
from boto.cloudsearch.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key,
**kwargs)


def check_extensions(module_name, module_path):
"""
This function checks for extensions to boto modules. It should be called in the
Expand Down
27 changes: 27 additions & 0 deletions boto/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,33 @@ def _calc_signature(self, params, verb, path, server_name):
boto.log.debug('base64 encoded digest: %s' % b64)
return (qs, b64)

class POSTPathQSV2AuthHandler(QuerySignatureV2AuthHandler, AuthHandler):
"""
Query Signature V2 Authentication relocating signed query
into the path and allowing POST requests with Content-Types.
"""

capability = ['mws']

def add_auth(self, req, **kwargs):
req.params['AWSAccessKeyId'] = self._provider.access_key
req.params['SignatureVersion'] = self.SignatureVersion
req.params['Timestamp'] = boto.utils.get_ts()
qs, signature = self._calc_signature(req.params, req.method,
req.auth_path, req.host)
boto.log.debug('query_string: %s Signature: %s' % (qs, signature))
if req.method == 'POST':
req.headers['Content-Length'] = str(len(req.body))
req.headers['Content-Type'] = req.headers.get('Content-Type',
'text/plain')
else:
req.body = ''
# if this is a retried req, the qs from the previous try will
# already be there, we need to get rid of that and rebuild it
req.path = req.path.split('?')[0]
req.path = (req.path + '?' + qs +
'&Signature=' + urllib.quote_plus(signature))


def get_auth_handler(host, config, provider, requested_capability=None):
"""Finds an AuthHandler that is ready to authenticate.
Expand Down
7 changes: 4 additions & 3 deletions boto/cloudformation/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ class CloudFormationConnection(AWSQueryConnection):
"""
A Connection to the CloudFormation Service.
"""
DefaultRegionName = 'us-east-1'
DefaultRegionEndpoint = 'cloudformation.us-east-1.amazonaws.com'
APIVersion = '2010-05-15'
APIVersion = boto.config.get('Boto', 'cfn_version', '2010-05-15')
DefaultRegionName = boto.config.get('Boto', 'cfn_region_name', 'us-east-1')
DefaultRegionEndpoint = boto.config.get('Boto', 'cfn_region_endpoint',
'cloudformation.us-east-1.amazonaws.com')

valid_states = ("CREATE_IN_PROGRESS", "CREATE_FAILED", "CREATE_COMPLETE",
"ROLLBACK_IN_PROGRESS", "ROLLBACK_FAILED", "ROLLBACK_COMPLETE",
Expand Down
18 changes: 18 additions & 0 deletions boto/cloudformation/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self, connection=None):
self.notification_arns = []
self.outputs = []
self.parameters = []
self.capabilities = []
self.stack_id = None
self.stack_status = None
self.stack_name = None
Expand All @@ -24,6 +25,9 @@ def startElement(self, name, attrs, connection):
elif name == "Outputs":
self.outputs = ResultSet([('member', Output)])
return self.outputs
elif name == "Capabilities":
self.capabilities = ResultSet([('member', Capability)])
return self.capabilities
else:
return None

Expand Down Expand Up @@ -165,6 +169,20 @@ def endElement(self, name, value, connection):
def __repr__(self):
return "Output:\"%s\"=\"%s\"" % (self.key, self.value)

class Capability:
def __init__(self, connection=None):
self.connection = None
self.value = None

def startElement(self, name, attrs, connection):
return None

def endElement(self, name, value, connection):
self.value = value

def __repr__(self):
return "Capability:\"%s\"" % (self.value)

class StackResource:
def __init__(self, connection=None):
self.connection = connection
Expand Down
2 changes: 1 addition & 1 deletion boto/cloudfront/invalidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, paths=None, connection=None, distribution=None, caller_refere
# If we passed in a distribution,
# then we use that as the connection object
if distribution:
self.connection = connection
self.connection = distribution
else:
self.connection = connection

Expand Down
45 changes: 45 additions & 0 deletions boto/cloudsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# 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,
# 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.ec2.regioninfo import RegionInfo


def regions():
"""
Get all available regions for the Amazon CloudSearch service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
import boto.cloudsearch.layer1
return [RegionInfo(name='us-east-1',
endpoint='cloudsearch.us-east-1.amazonaws.com',
connection_cls=boto.cloudsearch.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
Loading

0 comments on commit 1aa1133

Please sign in to comment.