Permalink
Browse files

Merged in changes from boto/boto.

  • Loading branch information...
2 parents 7f039fe + 5f204d1 commit 22e7e4404fd74d65044617b3ead75101912385ae John Walsh committed Feb 2, 2011
Showing with 3,612 additions and 2,351 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 bin/cfadmin
  3. +2 −1 bin/list_instances
  4. +63 −0 bin/route53
  5. +16 −10 boto/__init__.py
  6. +319 −0 boto/auth.py
  7. +58 −0 boto/auth_handler.py
  8. +10 −14 boto/cloudfront/__init__.py
  9. +135 −187 boto/connection.py
  10. +32 −1 boto/ec2/autoscale/__init__.py
  11. +13 −7 boto/ec2/cloudwatch/__init__.py
  12. +1 −1 boto/ec2/cloudwatch/metric.py
  13. +10 −15 boto/ec2/connection.py
  14. +76 −17 boto/ec2/elb/__init__.py
  15. +9 −0 boto/ec2/image.py
  16. +1 −1 boto/ec2/instance.py
  17. +2 −22 boto/ecs/__init__.py
  18. +3 −0 boto/emr/connection.py
  19. +16 −1 boto/exception.py
  20. +2 −5 boto/file/key.py
  21. +37 −24 boto/fps/connection.py
  22. +40 −2 boto/gs/bucket.py
  23. +3 −3 boto/gs/key.py
  24. +4 −3 boto/gs/resumable_upload_handler.py
  25. +5 −923 boto/iam/__init__.py
  26. +952 −0 boto/iam/connection.py
  27. +0 −146 boto/iam/response.py
  28. +223 −4 boto/mturk/connection.py
  29. +1 −3 boto/mturk/notification.py
  30. +3 −2 boto/mturk/qualification.py
  31. +90 −0 boto/plugin.py
  32. +3 −1 boto/rds/__init__.py
  33. +10 −7 boto/resultset.py
  34. +3 −274 boto/route53/__init__.py
  35. +285 −0 boto/route53/connection.py
  36. +125 −0 boto/route53/record.py
  37. +15 −10 boto/s3/bucket.py
  38. +9 −12 boto/s3/connection.py
  39. +149 −82 boto/s3/key.py
  40. +2 −0 boto/s3/multipart.py
  41. +12 −3 boto/sdb/__init__.py
  42. +211 −91 boto/sdb/connection.py
  43. +7 −3 boto/sdb/db/manager/sdbmanager.py
  44. +64 −51 boto/sdb/domain.py
  45. +74 −4 boto/sdb/item.py
  46. +5 −376 boto/sns/__init__.py
  47. +398 −0 boto/sns/connection.py
  48. +3 −1 boto/sqs/connection.py
  49. +7 −7 boto/sqs/queue.py
  50. +20 −0 boto/storage_uri.py
  51. +5 −0 boto/tests/test_s3connection.py
  52. +14 −15 boto/tests/test_sdbconnection.py
  53. +25 −7 boto/utils.py
  54. +1 −1 boto/vpc/__init__.py
  55. +1 −0 docs/source/conf.py
  56. +5 −5 docs/source/ref/file.rst
  57. +3 −3 docs/source/ref/gs.rst
  58. +3 −3 docs/source/ref/s3.rst
  59. +24 −0 docs/source/s3_tut.rst
  60. +1 −1 setup.py
View
@@ -1,4 +1,4 @@
*.pyc
.*.swp
*.log
-
+boto.egg-info
View
@@ -53,7 +53,7 @@ def invalidate(cf, origin_or_id, *paths):
sys.exit(1)
dist = None
for d in cf.get_all_distributions():
- if d.id == origin_or_id or d.origin == origin_or_id:
+ if d.id == origin_or_id or d.origin.dns_name == origin_or_id:
dist = d
break
if not dist:
View
@@ -16,7 +16,8 @@ HEADERS = {
'State': {'get': attrgetter('state'), 'length':15},
'Image': {'get': attrgetter('image_id'), 'length':15},
'Type': {'get': attrgetter('instance_type'), 'length':15},
- 'IP': {'get': attrgetter('ip_address'), 'length':15},
+ 'IP': {'get': attrgetter('ip_address'), 'length':16},
+ 'PrivateIP': {'get': attrgetter('private_ip_address'), 'length':16},
'Key': {'get': attrgetter('key_name'), 'length':25},
'T:': {'length': 30},
}
View
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# Author: Chris Moyer
+#
+# route53 is similar to sdbadmin for Route53, it's a simple
+# console utility to perform the most frequent tasks with Route53
+
+def _print_zone_info(zoneinfo):
+ print "="*80
+ print "| ID: %s" % zoneinfo['Id'].split("/")[-1]
+ print "| Name: %s" % zoneinfo['Name']
+ print "| Ref: %s" % zoneinfo['CallerReference']
+ print "="*80
+ print zoneinfo['Config']
+ print
+
+
+def create(conn, hostname, caller_reference=None, comment=''):
+ response = conn.create_hosted_zone(hostname, caller_reference, comment)
+ _print_zone_info(response['CreateHostedZoneResponse'])
+
+def ls(conn):
+ """List all hosted zones"""
+ response = conn.get_all_hosted_zones()
+ for zoneinfo in response['ListHostedZonesResponse']['HostedZones']:
+ _print_zone_info(zoneinfo)
+
+def get(conn, hosted_zone_id, type=None, name=None, maxitems=None):
+ response = conn.get_all_rrsets(hosted_zone_id, type, name, maxitems)
+ print '%-20s %-20s %-20s %s' % ("Name", "Type", "TTL", "Value(s)")
+ for record in response:
+ print '%-20s %-20s %-20s %s' % (record.name, record.type, record.ttl, ",".join(record.resource_records))
+
+
+def add_record(conn, hosted_zone_id, name, type, value, ttl=600, comment=""):
+ """Add a new record"""
+ from boto.route53.record import ResourceRecordSets
+ changes = ResourceRecordSets(conn, hosted_zone_id, comment)
+ change = changes.add_change("CREATE", name, type, ttl)
+ change.add_value(value)
+ print changes.commit()
+
+
+if __name__ == "__main__":
+ import boto
+ import sys
+ conn = boto.connect_route53()
+ self = sys.modules['__main__']
+ if len(sys.argv) >= 2:
+ try:
+ cmd = getattr(self, sys.argv[1])
+ except:
+ cmd = None
+ args = sys.argv[2:]
+ else:
+ cmd = help
+ args = []
+ if not cmd:
+ cmd = help
+ try:
+ cmd(conn, *args)
+ except TypeError, e:
+ print e
+ help(conn, cmd.__name__)
View
@@ -24,6 +24,7 @@
import boto
from boto.pyami.config import Config, BotoConfigLocations
from boto.storage_uri import BucketStorageUri, FileStorageUri
+import boto.plugin
import os, re, sys
import logging
import logging.config
@@ -391,23 +392,24 @@ def _get_aws_conn(service):
global _aws_cache
conn = _aws_cache.get(service)
if not conn:
- meth = getattr(sys.modules[__name__], 'connect_'+service)
+ meth = getattr(sys.modules[__name__], 'connect_' + service)
conn = meth()
_aws_cache[service] = conn
return conn
def lookup(service, name):
global _aws_cache
conn = _get_aws_conn(service)
- obj = _aws_cache.get('.'.join((service,name)), None)
+ obj = _aws_cache.get('.'.join((service, name)), None)
if not obj:
obj = conn.lookup(name)
- _aws_cache['.'.join((service,name))] = obj
+ _aws_cache['.'.join((service, name))] = obj
return obj
def storage_uri(uri_str, default_scheme='file', debug=0, validate=True,
bucket_storage_uri_class=BucketStorageUri):
- """Instantiate a StorageUri from a URI string.
+ """
+ Instantiate a StorageUri from a URI string.
:type uri_str: string
:param uri_str: URI naming bucket + optional object.
@@ -427,12 +429,14 @@ def storage_uri(uri_str, default_scheme='file', debug=0, validate=True,
:rtype: :class:`boto.StorageUri` subclass
:return: StorageUri subclass for given URI.
- uri_str must be one of the following formats:
- gs://bucket/name
- s3://bucket/name
- gs://bucket
- s3://bucket
- filename
+ ``uri_str`` must be one of the following formats:
+
+ * gs://bucket/name
+ * s3://bucket/name
+ * gs://bucket
+ * s3://bucket
+ * filename
+
The last example uses the default scheme ('file', unless overridden)
"""
@@ -489,3 +493,5 @@ def storage_uri_for_key(key):
prov_name = key.bucket.connection.provider.get_provider_name()
uri_str = '%s://%s/%s' % (prov_name, key.bucket.name, key.name)
return storage_uri(uri_str)
+
+boto.plugin.load_plugins(config)
Oops, something went wrong.

0 comments on commit 22e7e44

Please sign in to comment.