You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:37:04 UTC
svn commit: r1132068 [2/8] - in /incubator/mesos/trunk: ec2/
third_party/boto-1.9b/ third_party/boto-1.9b/bin/
third_party/boto-1.9b/boto.egg-info/ third_party/boto-1.9b/boto/
third_party/boto-1.9b/boto/cloudfront/ third_party/boto-1.9b/boto/contrib/
t...
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/distribution.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/distribution.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/distribution.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/distribution.py Sun Jun 5 08:36:52 2011
@@ -22,7 +22,7 @@
import uuid
from boto.cloudfront.identity import OriginAccessIdentity
from boto.cloudfront.object import Object, StreamingObject
-from boto.cloudfront.signers import Signer, ActiveTrustedSigners, TrustedSigners
+from boto.cloudfront.signers import ActiveTrustedSigners, TrustedSigners
from boto.cloudfront.logging import LoggingInfo
from boto.s3.acl import ACL
@@ -30,7 +30,8 @@ class DistributionConfig:
def __init__(self, connection=None, origin='', enabled=False,
caller_reference='', cnames=None, comment='',
- origin_access_identity=None, trusted_signers=None):
+ origin_access_identity=None, trusted_signers=None,
+ default_root_object=None):
self.connection = connection
self.origin = origin
self.enabled = enabled
@@ -45,6 +46,7 @@ class DistributionConfig:
self.origin_access_identity = origin_access_identity
self.trusted_signers = trusted_signers
self.logging = None
+ self.default_root_object = default_root_object
def get_oai_value(self):
if isinstance(self.origin_access_identity, OriginAccessIdentity):
@@ -54,7 +56,7 @@ class DistributionConfig:
def to_xml(self):
s = '<?xml version="1.0" encoding="UTF-8"?>\n'
- s += '<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2008-12-01/">\n'
+ s += '<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-07-15/">\n'
s += ' <Origin>%s</Origin>\n' % self.origin
s += ' <CallerReference>%s</CallerReference>\n' % self.caller_reference
for cname in self.cnames:
@@ -69,7 +71,7 @@ class DistributionConfig:
s += '</Enabled>\n'
if self.origin_access_identity:
val = self.get_oai_value()
- s += '<OriginAccessIdentifier>%s</OriginAccessIdentifier>\n' % val
+ s += '<OriginAccessIdentity>%s</OriginAccessIdentity>\n' % val
if self.trusted_signers:
s += '<TrustedSigners>\n'
for signer in self.trusted_signers:
@@ -83,6 +85,9 @@ class DistributionConfig:
s += ' <Bucket>%s</Bucket>\n' % self.logging.bucket
s += ' <Prefix>%s</Prefix>\n' % self.logging.prefix
s += '</Logging>\n'
+ if self.default_root_object:
+ dro = self.default_root_object
+ s += '<DefaultRootObject>%s</DefaultRootObject>\n' % dro
s += '</DistributionConfig>\n'
return s
@@ -112,6 +117,8 @@ class DistributionConfig:
self.caller_reference = value
elif name == 'OriginAccessIdentity':
self.origin_access_identity = value
+ elif name == 'DefaultRootObject':
+ self.default_root_object = value
else:
setattr(self, name, value)
@@ -216,6 +223,7 @@ class Distribution:
self.active_signers = None
self.etag = None
self._bucket = None
+ self._object_class = Object
def startElement(self, name, attrs, connection):
if name == 'DistributionConfig':
@@ -241,7 +249,8 @@ class Distribution:
def update(self, enabled=None, cnames=None, comment=None,
origin_access_identity=None,
- trusted_signers=None):
+ trusted_signers=None,
+ default_root_object=None):
"""
Update the configuration of the Distribution.
@@ -265,12 +274,17 @@ class Distribution:
:param trusted_signers: The AWS users who are authorized to sign
URL's for private content in this Distribution.
+ :type default_root_object: str
+ :param default_root_object: An option field that specifies a default
+ root object for the distribution (e.g. index.html)
+
"""
new_config = DistributionConfig(self.connection, self.config.origin,
self.config.enabled, self.config.caller_reference,
self.config.cnames, self.config.comment,
self.config.origin_access_identity,
- self.config.trusted_signers)
+ self.config.trusted_signers,
+ self.config.default_root_object)
if enabled != None:
new_config.enabled = enabled
if cnames != None:
@@ -281,6 +295,8 @@ class Distribution:
new_config.origin_access_identity = origin_access_identity
if trusted_signers:
new_config.trusted_signers = trusted_signers
+ if default_root_object:
+ new_config.default_root_object = default_root_object
self.etag = self.connection.set_distribution_config(self.id, self.etag, new_config)
self.config = new_config
self._object_class = Object
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/exception.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/exception.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/exception.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/exception.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/exception.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/identity.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/identity.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/identity.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/identity.py Sun Jun 5 08:36:52 2011
@@ -50,7 +50,7 @@ class OriginAccessIdentity:
setattr(self, name, value)
def update(self, comment=None):
- new_config = OriginAccessIdentifyConfig(self.connection,
+ new_config = OriginAccessIdentityConfig(self.connection,
self.config.caller_reference,
self.config.comment)
if comment != None:
@@ -59,10 +59,10 @@ class OriginAccessIdentity:
self.config = new_config
def delete(self):
- return self.connection.delete_distribution(self.id, self.etag)
+ return self.connection.delete_origin_access_identity(self.id, self.etag)
def uri(self):
- return 'origin-access-identity/cloudfront/%s' % id
+ return 'origin-access-identity/cloudfront/%s' % self.id
class OriginAccessIdentityConfig:
@@ -94,5 +94,29 @@ class OriginAccessIdentityConfig:
else:
setattr(self, name, value)
+class OriginAccessIdentitySummary:
+ def __init__(self, connection=None, id='',
+ s3_user_id='', comment=''):
+ self.connection = connection
+ self.id = id
+ self.s3_user_id = s3_user_id
+ self.comment = comment
+ self.etag = None
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'Id':
+ self.id = value
+ elif name == 'S3CanonicalUserId':
+ self.s3_user_id = value
+ elif name == 'Comment':
+ self.comment = value
+ else:
+ setattr(self, name, value)
+
+ def get_origin_access_identity(self):
+ return self.connection.get_origin_access_identity_info(self.id)
+
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/logging.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/logging.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/logging.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/object.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/object.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/object.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/signers.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/signers.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/cloudfront/signers.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/connection.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/connection.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/connection.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/connection.py Sun Jun 5 08:36:52 2011
@@ -1,6 +1,9 @@
-# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2010 Google
# Copyright (c) 2008 rPath, Inc.
# Copyright (c) 2009 The Echo Nest Corporation
+# Copyright (c) 2010, Eucalyptus Systems, Inc.
+# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -52,6 +55,7 @@ import Queue
import boto
from boto.exception import AWSConnectionError, BotoClientError, BotoServerError
from boto.resultset import ResultSet
+from boto.provider import Provider
import boto.utils
from boto import config, UserAgent, handler
@@ -99,11 +103,11 @@ class ConnectionPool:
def __repr__(self):
return 'ConnectionPool:%s' % ','.join(self._hosts._dict.keys())
-class AWSAuthConnection:
+class AWSAuthConnection(object):
def __init__(self, host, aws_access_key_id=None, aws_secret_access_key=None,
is_secure=True, port=None, proxy=None, proxy_port=None,
proxy_user=None, proxy_pass=None, debug=0,
- https_connection_factory=None, path='/'):
+ https_connection_factory=None, path='/', provider='aws'):
"""
:type host: string
:param host: The host to make the connection to
@@ -140,10 +144,14 @@ class AWSAuthConnection:
"""
self.num_retries = 5
+ # Override passed-in is_secure setting if value was defined in config.
+ if config.has_option('Boto', 'is_secure'):
+ is_secure = config.getboolean('Boto', 'is_secure')
self.is_secure = is_secure
self.handle_proxy(proxy, proxy_port, proxy_user, proxy_pass)
# define exceptions from httplib that we want to catch and retry
- self.http_exceptions = (httplib.HTTPException, socket.error, socket.gaierror)
+ self.http_exceptions = (httplib.HTTPException, socket.error,
+ socket.gaierror)
# define values in socket exceptions we don't want to catch
self.socket_exception_values = (errno.EINTR,)
if https_connection_factory is not None:
@@ -165,20 +173,14 @@ class AWSAuthConnection:
self.port = port
else:
self.port = PORTS_BY_SECURITY[is_secure]
-
- if aws_access_key_id:
- self.aws_access_key_id = aws_access_key_id
- elif os.environ.has_key('AWS_ACCESS_KEY_ID'):
- self.aws_access_key_id = os.environ['AWS_ACCESS_KEY_ID']
- elif config.has_option('Credentials', 'aws_access_key_id'):
- self.aws_access_key_id = config.get('Credentials', 'aws_access_key_id')
-
- if aws_secret_access_key:
- self.aws_secret_access_key = aws_secret_access_key
- elif os.environ.has_key('AWS_SECRET_ACCESS_KEY'):
- self.aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY']
- elif config.has_option('Credentials', 'aws_secret_access_key'):
- self.aws_secret_access_key = config.get('Credentials', 'aws_secret_access_key')
+
+ self.provider = Provider(provider,
+ aws_access_key_id,
+ aws_secret_access_key)
+
+ # allow config file to override default host
+ if self.provider.host:
+ self.host = self.provider.host
# initialize an HMAC for signatures, make copies with each request
self.hmac = hmac.new(self.aws_secret_access_key, digestmod=sha)
@@ -204,9 +206,20 @@ class AWSAuthConnection:
def connection(self):
return self.get_http_connection(*self._connection)
-
connection = property(connection)
+ def aws_access_key_id(self):
+ return self.provider.access_key
+ aws_access_key_id = property(aws_access_key_id)
+ gs_access_key_id = aws_access_key_id
+ access_key = aws_access_key_id
+
+ def aws_secret_access_key(self):
+ return self.provider.secret_key
+ aws_secret_access_key = property(aws_secret_access_key)
+ gs_secret_access_key = aws_secret_access_key
+ secret_key = aws_secret_access_key
+
def get_path(self, path='/'):
pos = path.find('?')
if pos >= 0:
@@ -239,8 +252,9 @@ class AWSAuthConnection:
# versions, it would append ":443" to the hostname sent
# in the Host header and so we needed to make sure we
# did the same when calculating the V2 signature. In 2.6
+ # (and higher!)
# it no longer does that. Hence, this kludge.
- if sys.version[:3] == "2.6" and port == 443:
+ if sys.version[:3] in ('2.6', '2.7') and port == 443:
signature_host = self.host
else:
signature_host = '%s:%d' % (self.host, port)
@@ -455,6 +469,10 @@ class AWSAuthConnection:
# header here, we did that in the CONNECT to the proxy.
headers.update(self.get_proxy_auth_header())
request_string = auth_path or path
+ for key in headers:
+ val = headers[key]
+ if isinstance(val, unicode):
+ headers[key] = urllib.quote_plus(val.encode('utf-8'))
self.add_aws_auth_header(headers, method, request_string)
return self._mexe(method, path, data, headers, host, sender)
@@ -464,12 +482,16 @@ class AWSAuthConnection:
headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
time.gmtime())
- c_string = boto.utils.canonical_string(method, path, headers)
+ c_string = boto.utils.canonical_string(method, path, headers,
+ None, self.provider)
boto.log.debug('Canonical: %s' % c_string)
hmac = self.hmac.copy()
hmac.update(c_string)
b64_hmac = base64.encodestring(hmac.digest()).strip()
- headers['Authorization'] = "AWS %s:%s" % (self.aws_access_key_id, b64_hmac)
+ auth_hdr = self.provider.auth_header
+ headers['Authorization'] = ("%s %s:%s" %
+ (auth_hdr,
+ self.aws_access_key_id, b64_hmac))
def close(self):
"""(Optional) Close any open HTTP connections. This is non-destructive,
@@ -477,11 +499,6 @@ class AWSAuthConnection:
boto.log.debug('closing all HTTP connections')
self.connection = None # compat field
- hosts = list(self._cache.keys())
- for host in hosts:
- conn = self._cache[host]
- conn.close()
- del self._cache[host]
class AWSQueryConnection(AWSAuthConnection):
@@ -645,4 +662,3 @@ class AWSQueryConnection(AWSAuthConnecti
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)
-
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/__init__.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/__init__.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/__init__.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/m2helpers.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/m2helpers.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/m2helpers.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/m2helpers.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/m2helpers.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/ymlmessage.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/ymlmessage.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/ymlmessage.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/contrib/ymlmessage.py Sun Jun 5 08:36:52 2011
@@ -29,24 +29,24 @@ from boto.sqs.message import Message
import yaml
class YAMLMessage(Message):
- """
- The YAMLMessage class provides a YAML compatible message. Encoding and
- decoding are handled automaticaly.
+ """
+ The YAMLMessage class provides a YAML compatible message. Encoding and
+ decoding are handled automaticaly.
- Access this message data like such:
+ Access this message data like such:
- m.data = [ 1, 2, 3]
- m.data[0] # Returns 1
+ m.data = [ 1, 2, 3]
+ m.data[0] # Returns 1
- This depends on the PyYAML package
- """
+ This depends on the PyYAML package
+ """
- def __init__(self, queue=None, body='', xml_attrs=None):
- self.data = None
- Message.__init__(self, queue, body)
+ def __init__(self, queue=None, body='', xml_attrs=None):
+ self.data = None
+ Message.__init__(self, queue, body)
- def set_body(self, body):
- self.data = yaml.load(body)
+ def set_body(self, body):
+ self.data = yaml.load(body)
- def get_body(self):
- return yaml.dump(self.data)
+ def get_body(self):
+ return yaml.dump(self.data)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/__init__.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/__init__.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/address.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/address.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/address.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/address.py Sun Jun 5 08:36:52 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -44,8 +44,15 @@ class Address(EC2Object):
else:
setattr(self, name, value)
- def delete(self):
- return self.connection.delete_address(self.public_ip)
+ def release(self):
+ return self.connection.release_address(self.public_ip)
+ delete = release
+ def associate(self, instance_id):
+ return self.connection.associate_address(instance_id, self.public_ip)
+ def disassociate(self):
+ return self.connection.disassociate_address(self.public_ip)
+
+
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/__init__.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/__init__.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/__init__.py Sun Jun 5 08:36:52 2011
@@ -25,9 +25,7 @@ Auto Scaling service.
"""
import boto
-from boto import config
from boto.connection import AWSQueryConnection
-from boto.resultset import ResultSet
from boto.ec2.regioninfo import RegionInfo
from boto.ec2.autoscale.request import Request
from boto.ec2.autoscale.trigger import Trigger
@@ -40,11 +38,13 @@ class AutoScaleConnection(AWSQueryConnec
APIVersion = boto.config.get('Boto', 'autoscale_version', '2009-05-15')
Endpoint = boto.config.get('Boto', 'autoscale_endpoint',
'autoscaling.amazonaws.com')
+ DefaultRegionName = 'us-east-1'
+ DefaultRegionEndpoint = 'autoscaling.amazonaws.com'
SignatureVersion = '2'
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
is_secure=True, port=None, proxy=None, proxy_port=None,
- proxy_user=None, proxy_pass=None, host=Endpoint, debug=1,
+ proxy_user=None, proxy_pass=None, debug=1,
https_connection_factory=None, region=None, path='/'):
"""
Init method to create a new connection to the AutoScaling service.
@@ -52,10 +52,17 @@ class AutoScaleConnection(AWSQueryConnec
B{Note:} The host argument is overridden by the host specified in the
boto configuration file.
"""
+ if not region:
+ region = RegionInfo(self, self.DefaultRegionName,
+ self.DefaultRegionEndpoint,
+ AutoScaleConnection)
+ self.region = region
AWSQueryConnection.__init__(self, aws_access_key_id,
- aws_secret_access_key, is_secure, port, proxy, proxy_port,
- proxy_user, proxy_pass, host, debug,
- https_connection_factory, path=path)
+ aws_secret_access_key,
+ is_secure, port, proxy, proxy_port,
+ proxy_user, proxy_pass,
+ self.region.endpoint, debug,
+ https_connection_factory, path=path)
def build_list_params(self, params, items, label):
""" items is a list of dictionaries or strings:
@@ -83,7 +90,7 @@ class AutoScaleConnection(AWSQueryConnec
}
if op.startswith('Create'):
if as_group.availability_zones:
- zones = self.availability_zones
+ zones = as_group.availability_zones
else:
zones = [as_group.availability_zone]
self.build_list_params(params, as_group.load_balancers,
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/activity.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/activity.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/activity.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/activity.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/activity.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/group.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/group.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/group.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/group.py Sun Jun 5 08:36:52 2011
@@ -21,7 +21,6 @@
import weakref
-from boto.ec2.zone import Zone
from boto.ec2.elb.listelement import ListElement
from boto.resultset import ResultSet
from boto.ec2.autoscale.trigger import Trigger
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/instance.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/instance.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/instance.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/instance.py Sun Jun 5 08:36:52 2011
@@ -43,9 +43,4 @@ class Instance(object):
else:
setattr(self, name, value)
- def terminate(self):
- """ Terminate this instance. """
- params = {'LaunchConfigurationName' : self.instance_id}
- return self.get_object('DeleteLaunchConfiguration', params,
- Request)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/launchconfig.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/launchconfig.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/launchconfig.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/request.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/request.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/request.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/request.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/request.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/trigger.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/trigger.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/autoscale/trigger.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/blockdevicemapping.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/blockdevicemapping.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/blockdevicemapping.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/blockdevicemapping.py Sun Jun 5 08:36:52 2011
@@ -20,10 +20,11 @@
# IN THE SOFTWARE.
#
-class EBSBlockDeviceType(object):
+class BlockDeviceType(object):
def __init__(self, connection=None):
self.connection = connection
+ self.ephemeral_name = None
self.volume_id = None
self.snapshot_id = None
self.status = None
@@ -37,6 +38,8 @@ class EBSBlockDeviceType(object):
def endElement(self, name, value, connection):
if name =='volumeId':
self.volume_id = value
+ elif name == 'virtualName':
+ self.ephemeral_name = value
elif name =='snapshotId':
self.snapshot_id = value
elif name == 'volumeSize':
@@ -53,6 +56,9 @@ class EBSBlockDeviceType(object):
else:
setattr(self, name, value)
+# for backwards compatibility
+EBSBlockDeviceType = BlockDeviceType
+
class BlockDeviceMapping(dict):
def __init__(self, connection=None):
@@ -63,7 +69,7 @@ class BlockDeviceMapping(dict):
def startElement(self, name, attrs, connection):
if name == 'ebs':
- self.current_value = EBSBlockDeviceType(self)
+ self.current_value = BlockDeviceType(self)
return self.current_value
def endElement(self, name, value, connection):
@@ -75,15 +81,18 @@ class BlockDeviceMapping(dict):
def build_list_params(self, params, prefix=''):
i = 1
for dev_name in self:
- pre = '%sBlockDeviceMapping.%d' % (pre, i)
+ pre = '%sBlockDeviceMapping.%d' % (prefix, i)
params['%s.DeviceName' % pre] = dev_name
- ebs = self[dev_name]
- if ebs.snapshot_id:
- params['%s.Ebs.SnapshotId' % pre] = ebs.snapshot_id
- if ebs.size:
- params['%s.Ebs.VolumeSize' % pre] = ebs.size
- if ebs.delete_on_termination:
- params['%s.Ebs.DeleteOnTermination' % pre] = 'true'
+ block_dev = self[dev_name]
+ if block_dev.ephemeral_name:
+ params['%s.VirtualName' % pre] = block_dev.ephemeral_name
else:
- params['%s.Ebs.DeleteOnTermination' % pre] = 'false'
+ if block_dev.snapshot_id:
+ params['%s.Ebs.SnapshotId' % pre] = block_dev.snapshot_id
+ if block_dev.size:
+ params['%s.Ebs.VolumeSize' % pre] = block_dev.size
+ if block_dev.delete_on_termination:
+ params['%s.Ebs.DeleteOnTermination' % pre] = 'true'
+ else:
+ params['%s.Ebs.DeleteOnTermination' % pre] = 'false'
i += 1
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/bundleinstance.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpngateway.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/bundleinstance.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/bundleinstance.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpngateway.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpngateway.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/bundleinstance.py Sun Jun 5 08:36:52 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -20,61 +20,59 @@
# IN THE SOFTWARE.
"""
-Represents a Vpn Gateway
+Represents an EC2 Bundle Task
"""
from boto.ec2.ec2object import EC2Object
-class Attachment(object):
-
- def __init__(self, connection=None):
- self.vpc_id = None
- self.state = None
-
- def startElement(self, name, attrs, connection):
- pass
+class BundleInstanceTask(EC2Object):
- def endElement(self, name, value, connection):
- if name == 'vpcId':
- self.vpc_id = value
- elif name == 'state':
- self.state = value
- else:
- setattr(self, name, value)
-
-class VpnGateway(EC2Object):
-
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
self.id = None
- self.type = None
+ self.instance_id = None
+ self.progress = None
+ self.start_time = None
self.state = None
- self.availability_zone = None
- self.attachments = []
+ self.bucket = None
+ self.prefix = None
+ self.upload_policy = None
+ self.upload_policy_signature = None
+ self.update_time = None
+ self.code = None
+ self.message = None
def __repr__(self):
- return 'VpnGateway:%s' % self.id
+ return 'BundleInstanceTask:%s' % self.id
def startElement(self, name, attrs, connection):
- if name == 'item':
- att = Attachment()
- self.attachments.append(att)
- return att
-
+ return None
+
def endElement(self, name, value, connection):
- if name == 'vpnGatewayId':
+ if name == 'bundleId':
self.id = value
- elif name == 'type':
- self.type = value
+ elif name == 'instanceId':
+ self.instance_id = value
+ elif name == 'progress':
+ self.progress = value
+ elif name == 'startTime':
+ self.start_time = value
elif name == 'state':
self.state = value
- elif name == 'availabilityZone':
- self.availability_zone = value
- elif name == 'attachments':
- pass
+ elif name == 'bucket':
+ self.bucket = value
+ elif name == 'prefix':
+ self.prefix = value
+ elif name == 'uploadPolicy':
+ self.upload_policy = value
+ elif name == 'uploadPolicySignature':
+ self.upload_policy_signature = value
+ elif name == 'updateTime':
+ self.update_time = value
+ elif name == 'code':
+ self.code = value
+ elif name == 'message':
+ self.message = value
else:
setattr(self, name, value)
- def attach(self, vpc_id):
- return self.connection.attach_vpn_gateway(self.id, vpc_id)
-
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/buyreservation.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/buyreservation.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/buyreservation.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/buyreservation.py Sun Jun 5 08:36:52 2011
@@ -20,7 +20,7 @@
# IN THE SOFTWARE.
import boto.ec2
-from boto.sdb.db.property import *
+from boto.sdb.db.property import StringProperty, IntegerProperty
from boto.manage import propget
InstanceTypes = ['m1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge']
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/__init__.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/__init__.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/__init__.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/__init__.py Sun Jun 5 08:36:52 2011
@@ -140,7 +140,6 @@ from boto.connection import AWSQueryConn
from boto.ec2.cloudwatch.metric import Metric
from boto.ec2.cloudwatch.datapoint import Datapoint
import boto
-import datetime
class CloudWatchConnection(AWSQueryConnection):
@@ -194,13 +193,21 @@ class CloudWatchConnection(AWSQueryConne
self.build_list_params(params, statistics, 'Statistics.member.%d')
return self.get_list('GetMetricStatistics', params, [('member', Datapoint)])
- def list_metrics(self):
+ def list_metrics(self, next_token=None):
"""
Returns a list of the valid metrics for which there is recorded data available.
- """
- response = self.make_request('ListMetrics')
- body = response.read()
- return self.get_list('ListMetrics', None, [('member', Metric)])
+
+ :type next_token: string
+ :param next_token: A maximum of 500 metrics will be returned at one time.
+ If more results are available, the ResultSet returned
+ will contain a non-Null next_token attribute. Passing
+ that token as a parameter to list_metrics will retrieve
+ the next page of metrics.
+ """
+ params = {}
+ if next_token:
+ params['NextToken'] = next_token
+ return self.get_list('ListMetrics', params, [('member', Metric)])
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/datapoint.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/datapoint.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/datapoint.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/datapoint.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/datapoint.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/metric.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/metric.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/metric.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/cloudwatch/metric.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/cloudwatch/metric.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/connection.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/connection.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/connection.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/connection.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/connection.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/connection.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/connection.py Sun Jun 5 08:36:52 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -24,10 +24,10 @@ Represents a connection to the EC2 servi
"""
import urllib
-import xml.sax
import base64
+import hmac
import boto
-from boto import config
+from hashlib import sha1 as sha
from boto.connection import AWSQueryConnection
from boto.resultset import ResultSet
from boto.ec2.image import Image, ImageAttribute
@@ -45,14 +45,15 @@ from boto.ec2.reservedinstance import Re
from boto.ec2.spotinstancerequest import SpotInstanceRequest
from boto.ec2.spotpricehistory import SpotPriceHistory
from boto.ec2.spotdatafeedsubscription import SpotDatafeedSubscription
-from boto.ec2.launchspecification import LaunchSpecification
+from boto.ec2.bundleinstance import BundleInstanceTask
+from boto.ec2.placementgroup import PlacementGroup
from boto.exception import EC2ResponseError
#boto.set_stream_logger('ec2')
class EC2Connection(AWSQueryConnection):
- APIVersion = boto.config.get('Boto', 'ec2_version', '2009-11-30')
+ APIVersion = boto.config.get('Boto', 'ec2_version', '2010-06-15')
DefaultRegionName = boto.config.get('Boto', 'ec2_region_name', 'us-east-1')
DefaultRegionEndpoint = boto.config.get('Boto', 'ec2_region_endpoint',
'ec2.amazonaws.com')
@@ -176,14 +177,14 @@ class EC2Connection(AWSQueryConnection):
except IndexError: # None of those images available
return None
- def register_image(self, name, description=None, image_location=None,
+ def register_image(self, name=None, description=None, image_location=None,
architecture=None, kernel_id=None, ramdisk_id=None,
root_device_name=None, block_device_map=None):
"""
Register an image.
:type name: string
- :param name: The name of the AMI.
+ :param name: The name of the AMI. Valid only for EBS-based images.
:type description: string
:param description: The description of the AMI.
@@ -210,7 +211,9 @@ class EC2Connection(AWSQueryConnection):
:rtype: string
:return: The new image id
"""
- params = {'Name': name}
+ params = {}
+ if name:
+ params['Name'] = name
if description:
params['Description'] = description
if architecture:
@@ -220,7 +223,7 @@ class EC2Connection(AWSQueryConnection):
if ramdisk_id:
params['RamdiskId'] = ramdisk_id
if image_location:
- params['Location'] = image_location
+ params['ImageLocation'] = image_location
if root_device_name:
params['RootDeviceName'] = root_device_name
if block_device_map:
@@ -272,11 +275,8 @@ class EC2Connection(AWSQueryConnection):
params['Description'] = description
if no_reboot:
params['NoReboot'] = 'true'
- rs = self.get_object('CreateImage', params, Image)
- image_id = getattr(rs, 'imageId', None)
- if not image_id:
- image_id = getattr(rs, 'ImageId', None)
- return image_id
+ img = self.get_object('CreateImage', params, Image)
+ return img.id
# ImageAttribute methods
@@ -381,7 +381,11 @@ class EC2Connection(AWSQueryConnection):
instance_type='m1.small', placement=None,
kernel_id=None, ramdisk_id=None,
monitoring_enabled=False, subnet_id=None,
- block_device_map=None):
+ block_device_map=None,
+ disable_api_termination=False,
+ instance_initiated_shutdown_behavior=None,
+ private_ip_address=None,
+ placement_group=None):
"""
Runs an image on EC2.
@@ -404,7 +408,10 @@ class EC2Connection(AWSQueryConnection):
:param user_data: The user data passed to the launched instances
:type instance_type: string
- :param instance_type: The type of instance to run (m1.small, m1.large, m1.xlarge)
+ :param instance_type: The type of instance to run. Current choices are:
+ m1.small | m1.large | m1.xlarge | c1.medium |
+ c1.xlarge | m2.xlarge | m2.2xlarge |
+ m2.4xlarge | cc1.4xlarge
:type placement: string
:param placement: The availability zone in which to launch the instances
@@ -421,11 +428,34 @@ class EC2Connection(AWSQueryConnection):
:type subnet_id: string
:param subnet_id: The subnet ID within which to launch the instances for VPC.
+ :type private_ip_address: string
+ :param private_ip_address: If you're using VPC, you can optionally use
+ this parameter to assign the instance a
+ specific available IP address from the
+ subnet (e.g., 10.0.0.25).
+
:type block_device_map: :class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
:param block_device_map: A BlockDeviceMapping data structure
describing the EBS volumes associated
with the Image.
+ :type disable_api_termination: bool
+ :param disable_api_termination: If True, the instances will be locked
+ and will not be able to be terminated
+ via the API.
+
+ :type instance_initiated_shutdown_behavior: string
+ :param instance_initiated_shutdown_behavior: Specifies whether the instance's
+ EBS volues are stopped (i.e. detached)
+ or terminated (i.e. deleted) when
+ the instance is shutdown by the
+ owner. Valid values are:
+ stop | terminate
+
+ :type placement_group: string
+ :param placement_group: If specified, this is the name of the placement
+ group in which the instance(s) will be launched.
+
:rtype: Reservation
:return: The :class:`boto.ec2.instance.Reservation` associated with the request for machines
"""
@@ -450,6 +480,8 @@ class EC2Connection(AWSQueryConnection):
params['InstanceType'] = instance_type
if placement:
params['Placement.AvailabilityZone'] = placement
+ if placement_group:
+ params['Placement.GroupName'] = placement_group
if kernel_id:
params['KernelId'] = kernel_id
if ramdisk_id:
@@ -458,8 +490,15 @@ class EC2Connection(AWSQueryConnection):
params['Monitoring.Enabled'] = 'true'
if subnet_id:
params['SubnetId'] = subnet_id
+ if private_ip_address:
+ params['PrivateIpAddress'] = private_ip_address
if block_device_map:
block_device_map.build_list_params(params)
+ if disable_api_termination:
+ params['DisableApiTermination'] = 'true'
+ if instance_initiated_shutdown_behavior:
+ val = instance_initiated_shutdown_behavior
+ params['InstanceInitiatedShutdownBehavior'] = val
return self.get_object('RunInstances', params, Reservation, verb='POST')
def terminate_instances(self, instance_ids=None):
@@ -477,17 +516,22 @@ class EC2Connection(AWSQueryConnection):
self.build_list_params(params, instance_ids, 'InstanceId')
return self.get_list('TerminateInstances', params, [('item', Instance)])
- def stop_instances(self, instance_ids=None):
+ def stop_instances(self, instance_ids=None, force=False):
"""
Stop the instances specified
:type instance_ids: list
:param instance_ids: A list of strings of the Instance IDs to stop
+
+ :type force: bool
+ :param force: Forces the instance to stop
:rtype: list
:return: A list of the instances stopped
"""
params = {}
+ if force:
+ params['Force'] = 'true'
if instance_ids:
self.build_list_params(params, instance_ids, 'InstanceId')
return self.get_list('StopInstances', params, [('item', Instance)])
@@ -565,61 +609,59 @@ class EC2Connection(AWSQueryConnection):
params['Attribute'] = attribute
return self.get_object('DescribeInstanceAttribute', params, InstanceAttribute)
- def modify_image_attribute(self, image_id, attribute='launchPermission',
- operation='add', user_ids=None, groups=None,
- product_codes=None):
+ def modify_instance_attribute(self, instance_id, attribute, value):
"""
- Changes an attribute of an image.
- See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html
+ Changes an attribute of an instance
- :type image_id: string
- :param image_id: The image id you wish to change
+ :type instance_id: string
+ :param instance_id: The instance id you wish to change
:type attribute: string
- :param attribute: The attribute you wish to change
-
- :type operation: string
- :param operation: Either add or remove (this is required for changing launchPermissions)
+ :param attribute: The attribute you wish to change.
+ AttributeName - Expected value (default)
+ instanceType - A valid instance type (m1.small)
+ kernel - Kernel ID (None)
+ ramdisk - Ramdisk ID (None)
+ userData - Base64 encoded String (None)
+ disableApiTermination - Boolean (true)
+ instanceInitiatedShutdownBehavior - stop|terminate
+ rootDeviceName - device name (None)
- :type user_ids: list
- :param user_ids: The Amazon IDs of users to add/remove attributes
+ :type value: string
+ :param value: The new value for the attribute
- :type groups: list
- :param groups: The groups to add/remove attributes
-
- :type product_codes: list
- :param product_codes: Amazon DevPay product code. Currently only one
- product code can be associated with an AMI. Once
- set, the product code cannot be changed or reset.
+ :rtype: bool
+ :return: Whether the operation succeeded or not
"""
- params = {'ImageId' : image_id,
+ # Allow a bool to be passed in for value of disableApiTermination
+ if attribute == 'disableApiTermination':
+ if isinstance(value, bool):
+ if value:
+ value = 'true'
+ else:
+ value = 'false'
+ params = {'InstanceId' : instance_id,
'Attribute' : attribute,
- 'OperationType' : operation}
- if user_ids:
- self.build_list_params(params, user_ids, 'UserId')
- if groups:
- self.build_list_params(params, groups, 'UserGroup')
- if product_codes:
- self.build_list_params(params, product_codes, 'ProductCode')
- return self.get_status('ModifyImageAttribute', params)
+ 'Value' : value}
+ return self.get_status('ModifyInstanceAttribute', params)
- def reset_image_attribute(self, image_id, attribute='launchPermission'):
+ def reset_instance_attribute(self, instance_id, attribute):
"""
- Resets an attribute of an AMI to its default value.
- See http://docs.amazonwebservices.com/AWSEC2/2008-02-01/DeveloperGuide/ApiReference-Query-ResetImageAttribute.html
+ Resets an attribute of an instance to its default value.
- :type image_id: string
- :param image_id: ID of the AMI for which an attribute will be described
+ :type instance_id: string
+ :param instance_id: ID of the instance
:type attribute: string
- :param attribute: The attribute to reset
+ :param attribute: The attribute to reset. Valid values are:
+ kernel|ramdisk
:rtype: bool
:return: Whether the operation succeeded or not
"""
- params = {'ImageId' : image_id,
+ params = {'InstanceId' : instance_id,
'Attribute' : attribute}
- return self.get_status('ResetImageAttribute', params)
+ return self.get_status('ResetInstanceAttribute', params)
# Spot Instances
@@ -746,7 +788,8 @@ class EC2Connection(AWSQueryConnection):
with the Image.
:rtype: Reservation
- :return: The :class:`boto.ec2.instance.Reservation` associated with the request for machines
+ :return: The :class:`boto.ec2.spotinstancerequest.SpotInstanceRequest`
+ associated with the request for machines
"""
params = {'LaunchSpecification.ImageId':image_id,
'SpotPrice' : price}
@@ -814,7 +857,7 @@ class EC2Connection(AWSQueryConnection):
Return the current spot instance data feed subscription
associated with this account, if any.
- :rtype: :class:`boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription
+ :rtype: :class:`boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription`
:return: The datafeed subscription object or None
"""
return self.get_object('DescribeSpotDatafeedSubscription',
@@ -826,13 +869,15 @@ class EC2Connection(AWSQueryConnection):
:type bucket: str or unicode
:param bucket: The name of the bucket where spot instance data
- will be written.
+ will be written. The account issuing this request
+ must have FULL_CONTROL access to the bucket
+ specified in the request.
:type prefix: str or unicode
:param prefix: An optional prefix that will be pre-pended to all
data files written to the bucket.
- :rtype: :class:`boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription
+ :rtype: :class:`boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription`
:return: The datafeed subscription object or None
"""
params = {'Bucket' : bucket}
@@ -1407,7 +1452,10 @@ class EC2Connection(AWSQueryConnection):
:rtype: list
:return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
"""
- return self.get_list('DescribeRegions', None, [('item', RegionInfo)])
+ regions = self.get_list('DescribeRegions', None, [('item', RegionInfo)])
+ for region in regions:
+ region.connection_cls = EC2Connection
+ return regions
#
# Reservation methods
@@ -1518,3 +1566,127 @@ class EC2Connection(AWSQueryConnection):
params = {'InstanceId' : instance_id}
return self.get_list('UnmonitorInstances', params, [('item', InstanceInfo)])
+ #
+ # Bundle Windows Instances
+ #
+
+ def bundle_instance(self, instance_id,
+ s3_bucket,
+ s3_prefix,
+ s3_upload_policy):
+ """
+ Bundle Windows instance.
+
+ :type instance_id: string
+ :param instance_id: The instance id
+
+ :type s3_bucket: string
+ :param s3_bucket: The bucket in which the AMI should be stored.
+
+ :type s3_prefix: string
+ :param s3_prefix: The beginning of the file name for the AMI.
+
+ :type s3_upload_policy: string
+ :param s3_upload_policy: Base64 encoded policy that specifies condition and permissions
+ for Amazon EC2 to upload the user's image into Amazon S3.
+ """
+
+ params = {'InstanceId' : instance_id,
+ 'Storage.S3.Bucket' : s3_bucket,
+ 'Storage.S3.Prefix' : s3_prefix,
+ 'Storage.S3.UploadPolicy' : s3_upload_policy}
+ params['Storage.S3.AWSAccessKeyId'] = self.aws_access_key_id
+ local_hmac = self.hmac.copy()
+ local_hmac.update(s3_upload_policy)
+ s3_upload_policy_signature = base64.b64encode(local_hmac.digest())
+ params['Storage.S3.UploadPolicySignature'] = s3_upload_policy_signature
+ return self.get_object('BundleInstance', params, BundleInstanceTask)
+
+ def get_all_bundle_tasks(self, bundle_ids=None):
+ """
+ Retrieve current bundling tasks. If no bundle id is specified, all tasks are retrieved.
+
+ :type bundle_ids: list
+ :param bundle_ids: A list of strings containing identifiers for
+ previously created bundling tasks.
+ """
+
+ params = {}
+ if bundle_ids:
+ self.build_list_params(params, bundle_ids, 'BundleId')
+ return self.get_list('DescribeBundleTasks', params, [('item', BundleInstanceTask)])
+
+ def cancel_bundle_task(self, bundle_id):
+ """
+ Cancel a previously submitted bundle task
+
+ :type bundle_id: string
+ :param bundle_id: The identifier of the bundle task to cancel.
+ """
+
+ params = {'BundleId' : bundle_id}
+ return self.get_object('CancelBundleTask', params, BundleInstanceTask)
+
+ def get_password_data(self, instance_id):
+ """
+ Get encrypted administrator password for a Windows instance.
+
+ :type instance_id: string
+ :param instance_id: The identifier of the instance to retrieve the password for.
+ """
+
+ params = {'InstanceId' : instance_id}
+ rs = self.get_object('GetPasswordData', params, ResultSet)
+ return rs.passwordData
+
+ #
+ # Cluster Placement Groups
+ #
+
+ def get_all_placement_groups(self, groupnames=None):
+ """
+ Get all placement groups associated with your account in a region.
+
+ :type groupnames: list
+ :param groupnames: A list of the names of placement groups to retrieve.
+ If not provided, all placement groups will be returned.
+
+ :rtype: list
+ :return: A list of :class:`boto.ec2.placementgroup.PlacementGroup`
+ """
+ params = {}
+ if groupnames:
+ self.build_list_params(params, groupnames, 'GroupName')
+ return self.get_list('DescribePlacementGroups', params, [('item', PlacementGroup)])
+
+ def create_placement_group(self, name, strategy='cluster'):
+ """
+ Create a new placement group for your account.
+ This will create the placement group within the region you
+ are currently connected to.
+
+ :type name: string
+ :param name: The name of the new placement group
+
+ :type strategy: string
+ :param strategy: The placement strategy of the new placement group.
+ Currently, the only acceptable value is "cluster".
+
+ :rtype: :class:`boto.ec2.placementgroup.PlacementGroup`
+ :return: The newly created :class:`boto.ec2.keypair.KeyPair`.
+ """
+ params = {'GroupName':name, 'Strategy':strategy}
+ group = self.get_status('CreatePlacementGroup', params)
+ return group
+
+ def delete_placement_group(self, name):
+ """
+ Delete a placement group from your account.
+
+ :type key_name: string
+ :param key_name: The name of the keypair to delete
+ """
+ params = {'GroupName':name}
+ return self.get_status('DeletePlacementGroup', params)
+
+
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/ec2object.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/ec2object.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/ec2object.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/ec2object.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/ec2object.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/__init__.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/__init__.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/__init__.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/healthcheck.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/healthcheck.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/healthcheck.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/healthcheck.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/healthcheck.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/instancestate.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/instancestate.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/instancestate.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/instancestate.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/instancestate.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listelement.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listelement.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listelement.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listelement.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listelement.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listener.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listener.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listener.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/listener.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listener.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/loadbalancer.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/loadbalancer.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/loadbalancer.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/loadbalancer.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/loadbalancer.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/loadbalancer.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/elb/loadbalancer.py Sun Jun 5 08:36:52 2011
@@ -20,10 +20,8 @@
# IN THE SOFTWARE.
from boto.ec2.elb.healthcheck import HealthCheck
-from boto.ec2.elb.instancestate import InstanceState
from boto.ec2.elb.listener import Listener
from boto.ec2.elb.listelement import ListElement
-from boto.ec2.zone import Zone
from boto.ec2.instanceinfo import InstanceInfo
from boto.resultset import ResultSet
@@ -137,8 +135,8 @@ class LoadBalancer(object):
return self.connection.delete_load_balancer(self.name)
def configure_health_check(self, health_check):
- self.connection.configure_health_check(self.name, health_check)
+ return self.connection.configure_health_check(self.name, health_check)
def get_instance_health(self, instances=None):
- self.connection.describe_instance_health(self.name, instances)
+ return self.connection.describe_instance_health(self.name, instances)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/image.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/image.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/image.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/image.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/image.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/image.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/image.py Sun Jun 5 08:36:52 2011
@@ -116,7 +116,12 @@ class Image(EC2Object):
security_groups=None, user_data=None,
addressing_type=None, instance_type='m1.small', placement=None,
kernel_id=None, ramdisk_id=None,
- monitoring_enabled=False, subnet_id=None):
+ monitoring_enabled=False, subnet_id=None,
+ block_device_map=None,
+ disable_api_termination=False,
+ instance_initiated_shutdown_behavior=None,
+ private_ip_address=None,
+ placement_group=None):
"""
Runs this instance.
@@ -139,10 +144,13 @@ class Image(EC2Object):
:param daddressing_type:
:type instance_type: string
- :param instance_type: The type of instance to run (m1.small, m1.large, m1.xlarge)
+ :param instance_type: The type of instance to run. Current choices are:
+ m1.small | m1.large | m1.xlarge | c1.medium |
+ c1.xlarge | m2.xlarge | m2.2xlarge |
+ m2.4xlarge | cc1.4xlarge
- :type placement:
- :param placement:
+ :type placement: string
+ :param placement: The availability zone in which to launch the instances
:type kernel_id: string
:param kernel_id: The ID of the kernel with which to launch the instances
@@ -156,6 +164,34 @@ class Image(EC2Object):
:type subnet_id: string
:param subnet_id: The subnet ID within which to launch the instances for VPC.
+ :type private_ip_address: string
+ :param private_ip_address: If you're using VPC, you can optionally use
+ this parameter to assign the instance a
+ specific available IP address from the
+ subnet (e.g., 10.0.0.25).
+
+ :type block_device_map: :class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
+ :param block_device_map: A BlockDeviceMapping data structure
+ describing the EBS volumes associated
+ with the Image.
+
+ :type disable_api_termination: bool
+ :param disable_api_termination: If True, the instances will be locked
+ and will not be able to be terminated
+ via the API.
+
+ :type instance_initiated_shutdown_behavior: string
+ :param instance_initiated_shutdown_behavior: Specifies whether the instance's
+ EBS volues are stopped (i.e. detached)
+ or terminated (i.e. deleted) when
+ the instance is shutdown by the
+ owner. Valid values are:
+ stop | terminate
+
+ :type placement_group: string
+ :param placement_group: If specified, this is the name of the placement
+ group in which the instance(s) will be launched.
+
:rtype: Reservation
:return: The :class:`boto.ec2.instance.Reservation` associated with the request for machines
"""
@@ -164,7 +200,11 @@ class Image(EC2Object):
user_data, addressing_type,
instance_type, placement,
kernel_id, ramdisk_id,
- monitoring_enabled, subnet_id)
+ monitoring_enabled, subnet_id,
+ block_device_map, disable_api_termination,
+ instance_initiated_shutdown_behavior,
+ private_ip_address,
+ placement_group)
def deregister(self):
return self.connection.deregister_image(self.id)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instance.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/instance.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instance.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instance.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/instance.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/instance.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instance.py Sun Jun 5 08:36:52 2011
@@ -97,7 +97,10 @@ class Instance(EC2Object):
self._in_monitoring_element = False
self.persistent = False
self.root_device_name = None
+ self.root_device_type = None
self.block_device_mapping = None
+ self.state_reason = None
+ self.group_name = None
def __repr__(self):
return 'Instance:%s' % self.id
@@ -110,6 +113,9 @@ class Instance(EC2Object):
return self.block_device_mapping
elif name == 'productCodes':
return self.product_codes
+ elif name == 'stateReason':
+ self.state_reason = StateReason()
+ return self.state_reason
return None
def endElement(self, name, value, connection):
@@ -144,6 +150,8 @@ class Instance(EC2Object):
self.instance_class = value
elif name == 'rootDeviceName':
self.root_device_name = value
+ elif name == 'rootDeviceType':
+ self.root_device_type = value
elif name == 'launchTime':
self.launch_time = value
elif name == 'availabilityZone':
@@ -178,39 +186,36 @@ class Instance(EC2Object):
self.persistent = True
else:
self.persistent = False
+ elif name == 'groupName':
+ if self._in_monitoring_element:
+ self.group_name = value
else:
setattr(self, name, value)
def _update(self, updated):
- self.updated = updated
- if hasattr(updated, 'dns_name'):
- self.dns_name = updated.dns_name
- self.public_dns_name = updated.dns_name
- if hasattr(updated, 'private_dns_name'):
- self.private_dns_name = updated.private_dns_name
- if hasattr(updated, 'ami_launch_index'):
- self.ami_launch_index = updated.ami_launch_index
- self.shutdown_state = updated.shutdown_state
- self.previous_state = updated.previous_state
- if hasattr(updated, 'state'):
- self.state = updated.state
- else:
- self.state = None
- if hasattr(updated, 'state_code'):
- self.state_code = updated.state_code
- else:
- self.state_code = None
+ self.__dict__.update(updated.__dict__)
def update(self):
rs = self.connection.get_all_instances([self.id])
if len(rs) > 0:
- self._update(rs[0].instances[0])
+ r = rs[0]
+ for i in r.instances:
+ if i.id == self.id:
+ self._update(i)
return self.state
- def stop(self):
+ def terminate(self):
rs = self.connection.terminate_instances([self.id])
self._update(rs[0])
+ def stop(self):
+ rs = self.connection.stop_instances([self.id])
+ self._update(rs[0])
+
+ def start(self):
+ rs = self.connection.start_instances([self.id])
+ self._update(rs[0])
+
def reboot(self):
return self.connection.reboot_instances([self.id])
@@ -278,3 +283,16 @@ class InstanceAttribute(dict):
self._current_value = value
else:
self[name] = self._current_value
+
+class StateReason(dict):
+
+ def __init__(self, parent=None):
+ dict.__init__(self)
+
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ if name != 'stateReason':
+ self[name] = value
+
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instanceinfo.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/instanceinfo.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instanceinfo.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/instanceinfo.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/instanceinfo.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/keypair.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/keypair.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/keypair.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/keypair.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/keypair.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/launchspecification.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/launchspecification.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/launchspecification.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/launchspecification.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/launchspecification.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/placementgroup.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpc.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/placementgroup.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/placementgroup.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpc.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/vpc/vpc.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/placementgroup.py Sun Jun 5 08:36:52 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -18,37 +18,34 @@
# 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.
-
"""
-Represents a Virtual Private Cloud.
+Represents an EC2 Placement Group
"""
-
from boto.ec2.ec2object import EC2Object
+from boto.exception import BotoClientError
-class VPC(EC2Object):
-
- def __init__(self, connection=None):
+class PlacementGroup(EC2Object):
+
+ def __init__(self, connection=None, name=None, strategy=None, state=None):
EC2Object.__init__(self, connection)
- self.id = None
- self.dhcp_options_id = None
- self.state = None
- self.cidr_block = None
+ self.name = name
+ self.strategy = strategy
+ self.state = state
def __repr__(self):
- return 'VPC:%s' % self.id
-
+ return 'PlacementGroup:%s' % self.name
+
def endElement(self, name, value, connection):
- if name == 'vpcId':
- self.id = value
- elif name == 'dhcpOptionsId':
- self.dhcp_options_id = value
+ if name == 'groupName':
+ self.name = value
+ elif name == 'strategy':
+ self.strategy = value
elif name == 'state':
self.state = value
- elif name == 'cidrBlock':
- self.cidr_block = value
else:
setattr(self, name, value)
def delete(self):
- return self.connection.delete_vpc(self.id)
+ return self.connection.delete_placement_group(self.name)
+
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/regioninfo.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listelement.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/regioninfo.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/regioninfo.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listelement.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/elb/listelement.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/regioninfo.py Sun Jun 5 08:36:52 2011
@@ -1,4 +1,6 @@
-# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2010, Eucalyptus Systems, Inc.
+# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -19,13 +21,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-class ListElement(list):
+from boto.regioninfo import RegionInfo
- def startElement(self, name, attrs, connection):
- pass
-
- def endElement(self, name, value, connection):
- if name == 'member':
- self.append(value)
-
+class EC2RegionInfo(RegionInfo):
+ """
+ Represents an EC2 Region
+ """
+ def __init__(self, connection=None, name=None, endpoint=None):
+ from boto.ec2.connection import EC2Connection
+ RegionInfo.__init__(self, connection, name, endpoint,
+ EC2Connection)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/reservedinstance.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/reservedinstance.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/reservedinstance.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/reservedinstance.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/reservedinstance.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/securitygroup.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/securitygroup.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/securitygroup.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/securitygroup.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/securitygroup.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/securitygroup.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/securitygroup.py Sun Jun 5 08:36:52 2011
@@ -23,6 +23,7 @@
Represents an EC2 Security Group
"""
from boto.ec2.ec2object import EC2Object
+from boto.exception import BotoClientError
class SecurityGroup(EC2Object):
@@ -60,9 +61,9 @@ class SecurityGroup(EC2Object):
self.status = True
else:
raise Exception(
- 'Unexpected value of status %s for image %s'%(
+ 'Unexpected value of status %s for group %s'%(
value,
- self.id
+ self.name
)
)
else:
@@ -73,6 +74,11 @@ class SecurityGroup(EC2Object):
def add_rule(self, ip_protocol, from_port, to_port,
src_group_name, src_group_owner_id, cidr_ip):
+ """
+ Add a rule to the SecurityGroup object. Note that this method
+ only changes the local version of the object. No information
+ is sent to EC2.
+ """
rule = IPPermissions(self)
rule.ip_protocol = ip_protocol
rule.from_port = from_port
@@ -82,6 +88,11 @@ class SecurityGroup(EC2Object):
def remove_rule(self, ip_protocol, from_port, to_port,
src_group_name, src_group_owner_id, cidr_ip):
+ """
+ Remove a rule to the SecurityGroup object. Note that this method
+ only changes the local version of the object. No information
+ is sent to EC2.
+ """
target_rule = None
for rule in self.rules:
if rule.ip_protocol == ip_protocol:
@@ -245,7 +256,7 @@ class IPPermissions:
else:
setattr(self, name, value)
- def add_grant(self, owner_id=None, name=None, cidr_ip=None):
+ def add_grant(self, name=None, owner_id=None, cidr_ip=None):
grant = GroupOrCIDR(self)
grant.owner_id = owner_id
grant.name = name
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/snapshot.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/snapshot.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/snapshot.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/snapshot.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/snapshot.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/snapshot.py (original)
+++ incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/snapshot.py Sun Jun 5 08:36:52 2011
@@ -52,7 +52,10 @@ class Snapshot(EC2Object):
elif name == 'ownerId':
self.owner_id = value
elif name == 'volumeSize':
- self.volume_size = int(value)
+ try:
+ self.volume_size = int(value)
+ except:
+ self.volume_size = value
elif name == 'description':
self.description = value
else:
Copied: incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/spotdatafeedsubscription.py (from r1132067, incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/spotdatafeedsubscription.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/spotdatafeedsubscription.py?p2=incubator/mesos/trunk/third_party/boto-2.0b2/boto/ec2/spotdatafeedsubscription.py&p1=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/spotdatafeedsubscription.py&r1=1132067&r2=1132068&rev=1132068&view=diff
==============================================================================
(empty)