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:34:13 UTC
svn commit: r1132067 [2/9] - in /incubator/mesos/trunk: ec2/
third_party/boto-1.8d/ third_party/boto-1.8d/bin/
third_party/boto-1.8d/boto.egg-info/ third_party/boto-1.8d/boto/
third_party/boto-1.8d/boto/cloudfront/ third_party/boto-1.8d/boto/contrib/
t...
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto.egg-info/top_level.txt (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto.egg-info/top_level.txt)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto.egg-info/top_level.txt?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto.egg-info/top_level.txt&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto.egg-info/top_level.txt&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/__init__.py Sun Jun 5 08:34:02 2011
@@ -24,7 +24,7 @@ import os, sys
import logging
import logging.config
-Version = '1.8d'
+Version = '1.9b'
UserAgent = 'Boto/%s (%s)' % (Version, sys.platform)
config = Config()
@@ -35,7 +35,12 @@ def init_logging():
except:
pass
+class NullHandler(logging.Handler):
+ def emit(self, record):
+ pass
+
log = logging.getLogger('boto')
+log.addHandler(NullHandler())
init_logging()
# convenience function to set logging to a particular file
@@ -52,132 +57,173 @@ def set_file_logger(name, filepath, leve
logger.addHandler(fh)
log = logger
+def set_stream_logger(name, level=logging.DEBUG, format_string=None):
+ global log
+ if not format_string:
+ format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
+ logger = logging.getLogger(name)
+ logger.setLevel(level)
+ fh = logging.StreamHandler()
+ fh.setLevel(level)
+ formatter = logging.Formatter(format_string)
+ fh.setFormatter(formatter)
+ logger.addHandler(fh)
+ log = logger
+
def connect_sqs(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{SQSConnection<boto.sqs.connection.SQSConnection>}
- @return: A connection to Amazon's SQS
+ :rtype: :class:`boto.sqs.connection.SQSConnection`
+ :return: A connection to Amazon's SQS
"""
from boto.sqs.connection import SQSConnection
return SQSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_s3(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{S3Connection<boto.s3.connection.S3Connection>}
- @return: A connection to Amazon's S3
+ :rtype: :class:`boto.s3.connection.S3Connection`
+ :return: A connection to Amazon's S3
"""
from boto.s3.connection import S3Connection
return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_ec2(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{EC2Connection<boto.ec2.connection.EC2Connection>}
- @return: A connection to Amazon's EC2
+ :rtype: :class:`boto.ec2.connection.EC2Connection`
+ :return: A connection to Amazon's EC2
"""
from boto.ec2.connection import EC2Connection
return EC2Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_elb(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{ELBConnection<boto.ec2.elb.ELBConnection>}
- @return: A connection to Amazon's Load Balancing Service
+ :rtype: :class:`boto.ec2.elb.ELBConnection`
+ :return: A connection to Amazon's Load Balancing Service
"""
from boto.ec2.elb import ELBConnection
return ELBConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_autoscale(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{AutoScaleConnnection<boto.ec2.autoscale.AutoScaleConnection>}
- @return: A connection to Amazon's Auto Scaling Service
+ :rtype: :class:`boto.ec2.autoscale.AutoScaleConnection`
+ :return: A connection to Amazon's Auto Scaling Service
"""
from boto.ec2.autoscale import AutoScaleConnection
return AutoScaleConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_cloudwatch(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{CloudWatchConnection<boto.ec2.cloudwatch.CloudWatchConnection>}
- @return: A connection to Amazon's EC2 Monitoring service
+ :rtype: :class:`boto.ec2.cloudwatch.CloudWatchConnection`
+ :return: A connection to Amazon's EC2 Monitoring service
"""
from boto.ec2.cloudwatch import CloudWatchConnection
return CloudWatchConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_sdb(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{SDBConnection<boto.sdb.connection.SDBConnection>}
- @return: A connection to Amazon's SDB
+ :rtype: :class:`boto.sdb.connection.SDBConnection`
+ :return: A connection to Amazon's SDB
"""
from boto.sdb.connection import SDBConnection
return SDBConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_fps(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{FPSConnection<boto.fps.connection.FPSConnection>}
- @return: A connection to FPS
+ :rtype: :class:`boto.fps.connection.FPSConnection`
+ :return: A connection to FPS
"""
from boto.fps.connection import FPSConnection
return FPSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
def connect_cloudfront(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_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
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Your AWS Secret Access Key
- @rtype: L{FPSConnection<boto.fps.connection.FPSConnection>}
- @return: A connection to FPS
+ :rtype: :class:`boto.fps.connection.FPSConnection`
+ :return: A connection to FPS
"""
from boto.cloudfront import CloudFrontConnection
return CloudFrontConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
+def connect_vpc(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.vpc.VPCConnection`
+ :return: A connection to VPC
+ """
+ from boto.vpc import VPCConnection
+ return VPCConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
+
+def connect_rds(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.rds.RDSConnection`
+ :return: A connection to RDS
+ """
+ from boto.rds import RDSConnection
+ return RDSConnection(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
Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/__init__.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/__init__.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/__init__.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/__init__.py Sun Jun 5 08:34:02 2011
@@ -0,0 +1,222 @@
+# 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
+# "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.
+#
+
+import xml.sax
+import base64
+import time
+import boto.utils
+from boto.connection import AWSAuthConnection
+from boto import handler
+from boto.cloudfront.distribution import *
+from boto.cloudfront.identity import OriginAccessIdentity
+from boto.cloudfront.identity import OriginAccessIdentityConfig
+from boto.resultset import ResultSet
+from boto.cloudfront.exception import CloudFrontServerError
+
+class CloudFrontConnection(AWSAuthConnection):
+
+ DefaultHost = 'cloudfront.amazonaws.com'
+ Version = '2009-12-01'
+
+ def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
+ port=None, proxy=None, proxy_port=None,
+ host=DefaultHost, debug=0):
+ AWSAuthConnection.__init__(self, host,
+ aws_access_key_id, aws_secret_access_key,
+ True, port, proxy, proxy_port, debug=debug)
+
+ def get_etag(self, response):
+ response_headers = response.msg
+ for key in response_headers.keys():
+ if key.lower() == 'etag':
+ return response_headers[key]
+ return None
+
+ def add_aws_auth_header(self, headers, method, path):
+ if not headers.has_key('Date'):
+ headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
+ time.gmtime())
+
+ hmac = self.hmac.copy()
+ hmac.update(headers['Date'])
+ b64_hmac = base64.encodestring(hmac.digest()).strip()
+ headers['Authorization'] = "AWS %s:%s" % (self.aws_access_key_id, b64_hmac)
+
+ # Generics
+
+ def _get_all_objects(self, resource, tags):
+ if not tags:
+ tags=[('DistributionSummary', DistributionSummary)]
+ response = self.make_request('GET', '/%s/%s' % (self.Version, resource))
+ body = response.read()
+ if response.status >= 300:
+ raise CloudFrontServerError(response.status, response.reason, body)
+ rs = ResultSet(tags)
+ h = handler.XmlHandler(rs, self)
+ xml.sax.parseString(body, h)
+ return rs
+
+ def _get_info(self, id, resource, dist_class):
+ uri = '/%s/%s/%s' % (self.Version, resource, id)
+ response = self.make_request('GET', uri)
+ body = response.read()
+ if response.status >= 300:
+ raise CloudFrontServerError(response.status, response.reason, body)
+ d = dist_class(connection=self)
+ response_headers = response.msg
+ for key in response_headers.keys():
+ if key.lower() == 'etag':
+ d.etag = response_headers[key]
+ h = handler.XmlHandler(d, self)
+ xml.sax.parseString(body, h)
+ return d
+
+ def _get_config(self, id, resource, config_class):
+ uri = '/%s/%s/%s/config' % (self.Version, resource, id)
+ response = self.make_request('GET', uri)
+ body = response.read()
+ if response.status >= 300:
+ raise CloudFrontServerError(response.status, response.reason, body)
+ d = config_class(connection=self)
+ d.etag = self.get_etag(response)
+ h = handler.XmlHandler(d, self)
+ xml.sax.parseString(body, h)
+ return d
+
+ def _set_config(self, distribution_id, etag, config):
+ if isinstance(config, StreamingDistributionConfig):
+ resource = 'streaming-distribution'
+ else:
+ resource = 'distribution'
+ uri = '/%s/%s/%s/config' % (self.Version, resource, distribution_id)
+ headers = {'If-Match' : etag, 'Content-Type' : 'text/xml'}
+ response = self.make_request('PUT', uri, headers, config.to_xml())
+ body = response.read()
+ return self.get_etag(response)
+ if response.status != 200:
+ raise CloudFrontServerError(response.status, response.reason, body)
+
+ def _create_object(self, config, resource, dist_class):
+ response = self.make_request('POST', '/%s/%s' % (self.Version, resource),
+ {'Content-Type' : 'text/xml'}, data=config.to_xml())
+ body = response.read()
+ if response.status == 201:
+ d = dist_class(connection=self)
+ h = handler.XmlHandler(d, self)
+ xml.sax.parseString(body, h)
+ return d
+ else:
+ raise CloudFrontServerError(response.status, response.reason, body)
+
+ def _delete_object(self, id, etag, resource):
+ uri = '/%s/%s/%s' % (self.Version, resource, id)
+ response = self.make_request('DELETE', uri, {'If-Match' : etag})
+ body = response.read()
+ if response.status != 204:
+ raise CloudFrontServerError(response.status, response.reason, body)
+
+ # Distributions
+
+ def get_all_distributions(self):
+ tags=[('DistributionSummary', DistributionSummary)]
+ return self._get_all_objects('distribution', tags)
+
+ def get_distribution_info(self, distribution_id):
+ return self._get_info(distribution_id, 'distribution', Distribution)
+
+ def get_distribution_config(self, distribution_id):
+ return self._get_config(distribution_id, 'distribution',
+ DistributionConfig)
+
+ def set_distribution_config(self, distribution_id, etag, config):
+ return self._set_config(distribution_id, etag, config)
+
+ def create_distribution(self, origin, enabled, caller_reference='',
+ cnames=None, comment=''):
+ config = DistributionConfig(origin=origin, enabled=enabled,
+ caller_reference=caller_reference,
+ cnames=cnames, comment=comment)
+ return self._create_object(config, 'distribution', Distribution)
+
+ def delete_distribution(self, distribution_id, etag):
+ return self._delete_object(distribution_id, etag, 'distribution')
+
+ # Streaming Distributions
+
+ def get_all_streaming_distributions(self):
+ tags=[('StreamingDistributionSummary', StreamingDistributionSummary)]
+ return self._get_all_objects('streaming-distribution', tags)
+
+ def get_streaming_distribution_info(self, distribution_id):
+ return self._get_info(distribution_id, 'streaming-distribution',
+ StreamingDistribution)
+
+ def get_streaming_distribution_config(self, distribution_id):
+ return self._get_config(distribution_id, 'streaming-distribution',
+ StreamingDistributionConfig)
+
+ def set_streaming_distribution_config(self, distribution_id, etag, config):
+ return self._set_config(distribution_id, etag, config)
+
+ def create_streaming_distribution(self, origin, enabled,
+ caller_reference='',
+ cnames=None, comment=''):
+ config = StreamingDistributionConfig(origin=origin, enabled=enabled,
+ caller_reference=caller_reference,
+ cnames=cnames, comment=comment)
+ return self._create_object(config, 'streaming-distribution',
+ StreamingDistribution)
+
+ def delete_streaming_distribution(self, distribution_id, etag):
+ return self._delete_object(distribution_id, etag, 'streaming-distribution')
+
+ # Origin Access Identity
+
+ def get_all_origin_access_identity(self):
+ tags=[('CloudFrontOriginAccessIdentitySummary',
+ OriginAccessIdentitySummary)]
+ return self._get_all_objects('origin-access-identity/cloudfront', tags)
+
+ def get_origin_access_identity_info(self, access_id):
+ return self._get_info(access_id, 'origin-access-identity/cloudfront',
+ OriginAccessIdentity)
+
+ def get_origin_access_identity_config(self, access_id):
+ return self._get_config(access_id,
+ 'origin-access-identity/cloudfront',
+ OriginAccessIdentityConfig)
+
+ def set_origin_access_identity_config(self, access_id,
+ etag, config):
+ return self._set_config(access_id, etag, config)
+
+ def create_origin_access_identity(self, caller_reference='', comment=''):
+ config = OriginAccessIdentityConfig(caller_reference=caller_reference,
+ comment=comment)
+ return self._create_object(config, 'origin-access-identity/cloudfront',
+ OriginAccessIdentity)
+
+ def delete_origin_access_identity(self, access_id, etag):
+ return self._delete_object(access_id, etag,
+ 'origin-access-identity/cloudfront')
+
+
Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/distribution.py Sun Jun 5 08:34:02 2011
@@ -0,0 +1,470 @@
+# 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
+# "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.
+
+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.logging import LoggingInfo
+from boto.s3.acl import ACL
+
+class DistributionConfig:
+
+ def __init__(self, connection=None, origin='', enabled=False,
+ caller_reference='', cnames=None, comment='',
+ origin_access_identity=None, trusted_signers=None):
+ self.connection = connection
+ self.origin = origin
+ self.enabled = enabled
+ if caller_reference:
+ self.caller_reference = caller_reference
+ else:
+ self.caller_reference = str(uuid.uuid4())
+ self.cnames = []
+ if cnames:
+ self.cnames = cnames
+ self.comment = comment
+ self.origin_access_identity = origin_access_identity
+ self.trusted_signers = trusted_signers
+ self.logging = None
+
+ def get_oai_value(self):
+ if isinstance(self.origin_access_identity, OriginAccessIdentity):
+ return self.origin_access_identity.uri()
+ else:
+ return self.origin_access_identity
+
+ 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 += ' <Origin>%s</Origin>\n' % self.origin
+ s += ' <CallerReference>%s</CallerReference>\n' % self.caller_reference
+ for cname in self.cnames:
+ s += ' <CNAME>%s</CNAME>\n' % cname
+ if self.comment:
+ s += ' <Comment>%s</Comment>\n' % self.comment
+ s += ' <Enabled>'
+ if self.enabled:
+ s += 'true'
+ else:
+ s += 'false'
+ s += '</Enabled>\n'
+ if self.origin_access_identity:
+ val = self.get_oai_value()
+ s += '<OriginAccessIdentifier>%s</OriginAccessIdentifier>\n' % val
+ if self.trusted_signers:
+ s += '<TrustedSigners>\n'
+ for signer in self.trusted_signers:
+ if signer == 'Self':
+ s += ' <Self></Self>\n'
+ else:
+ s += ' <AwsAccountNumber>%s</AwsAccountNumber>\n' % signer
+ s += '</TrustedSigners>\n'
+ if self.logging:
+ s += '<Logging>\n'
+ s += ' <Bucket>%s</Bucket>\n' % self.logging.bucket
+ s += ' <Prefix>%s</Prefix>\n' % self.logging.prefix
+ s += '</Logging>\n'
+ s += '</DistributionConfig>\n'
+ return s
+
+ def startElement(self, name, attrs, connection):
+ if name == 'TrustedSigners':
+ self.trusted_signers = TrustedSigners()
+ return self.trusted_signers
+ elif name == 'Logging':
+ self.logging = LoggingInfo()
+ return self.logging
+ else:
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'CNAME':
+ self.cnames.append(value)
+ elif name == 'Origin':
+ self.origin = value
+ elif name == 'Comment':
+ self.comment = value
+ elif name == 'Enabled':
+ if value.lower() == 'true':
+ self.enabled = True
+ else:
+ self.enabled = False
+ elif name == 'CallerReference':
+ self.caller_reference = value
+ elif name == 'OriginAccessIdentity':
+ self.origin_access_identity = value
+ else:
+ setattr(self, name, value)
+
+class StreamingDistributionConfig(DistributionConfig):
+
+ def __init__(self, connection=None, origin='', enabled=False,
+ caller_reference='', cnames=None, comment=''):
+ DistributionConfig.__init__(self, connection, origin,
+ enabled, caller_reference,
+ cnames, comment)
+
+ def to_xml(self):
+ s = '<?xml version="1.0" encoding="UTF-8"?>\n'
+ s += '<StreamingDistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/">\n'
+ s += ' <Origin>%s</Origin>\n' % self.origin
+ s += ' <CallerReference>%s</CallerReference>\n' % self.caller_reference
+ for cname in self.cnames:
+ s += ' <CNAME>%s</CNAME>\n' % cname
+ if self.comment:
+ s += ' <Comment>%s</Comment>\n' % self.comment
+ s += ' <Enabled>'
+ if self.enabled:
+ s += 'true'
+ else:
+ s += 'false'
+ s += '</Enabled>\n'
+ s += '</StreamingDistributionConfig>\n'
+ return s
+
+ def startElement(self, name, attrs, connection):
+ pass
+
+class DistributionSummary:
+
+ def __init__(self, connection=None, domain_name='', id='',
+ last_modified_time=None, status='', origin='',
+ cname='', comment='', enabled=False):
+ self.connection = connection
+ self.domain_name = domain_name
+ self.id = id
+ self.last_modified_time = last_modified_time
+ self.status = status
+ self.origin = origin
+ self.enabled = enabled
+ self.cnames = []
+ if cname:
+ self.cnames.append(cname)
+ self.comment = comment
+ self.trusted_signers = None
+ self.etag = None
+ self.streaming = False
+
+ def startElement(self, name, attrs, connection):
+ if name == 'TrustedSigners':
+ self.trusted_signers = TrustedSigners()
+ return self.trusted_signers
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'Id':
+ self.id = value
+ elif name == 'Status':
+ self.status = value
+ elif name == 'LastModifiedTime':
+ self.last_modified_time = value
+ elif name == 'DomainName':
+ self.domain_name = value
+ elif name == 'Origin':
+ self.origin = value
+ elif name == 'CNAME':
+ self.cnames.append(value)
+ elif name == 'Comment':
+ self.comment = value
+ elif name == 'Enabled':
+ if value.lower() == 'true':
+ self.enabled = True
+ else:
+ self.enabled = False
+ elif name == 'StreamingDistributionSummary':
+ self.streaming = True
+ else:
+ setattr(self, name, value)
+
+ def get_distribution(self):
+ return self.connection.get_distribution_info(self.id)
+
+class StreamingDistributionSummary(DistributionSummary):
+
+ def get_distribution(self):
+ return self.connection.get_streaming_distribution_info(self.id)
+
+class Distribution:
+
+ def __init__(self, connection=None, config=None, domain_name='',
+ id='', last_modified_time=None, status=''):
+ self.connection = connection
+ self.config = config
+ self.domain_name = domain_name
+ self.id = id
+ self.last_modified_time = last_modified_time
+ self.status = status
+ self.active_signers = None
+ self.etag = None
+ self._bucket = None
+
+ def startElement(self, name, attrs, connection):
+ if name == 'DistributionConfig':
+ self.config = DistributionConfig()
+ return self.config
+ elif name == 'ActiveTrustedSigners':
+ self.active_signers = ActiveTrustedSigners()
+ return self.active_signers
+ else:
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'Id':
+ self.id = value
+ elif name == 'LastModifiedTime':
+ self.last_modified_time = value
+ elif name == 'Status':
+ self.status = value
+ elif name == 'DomainName':
+ self.domain_name = value
+ else:
+ setattr(self, name, value)
+
+ def update(self, enabled=None, cnames=None, comment=None,
+ origin_access_identity=None,
+ trusted_signers=None):
+ """
+ Update the configuration of the Distribution.
+
+ :type enabled: bool
+ :param enabled: Whether the Distribution is active or not.
+
+ :type cnames: list of str
+ :param cnames: The DNS CNAME's associated with this
+ Distribution. Maximum of 10 values.
+
+ :type comment: str or unicode
+ :param comment: The comment associated with the Distribution.
+
+ :type origin_access_identity: :class:`boto.cloudfront.identity.OriginAccessIdentity`
+ :param origin_access_identity: The CloudFront origin access identity
+ associated with the distribution. This
+ must be provided if you want the
+ distribution to serve private content.
+
+ :type trusted_signers: :class:`boto.cloudfront.signers.TrustedSigner`
+ :param trusted_signers: The AWS users who are authorized to sign
+ URL's for private content in this Distribution.
+
+ """
+ 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)
+ if enabled != None:
+ new_config.enabled = enabled
+ if cnames != None:
+ new_config.cnames = cnames
+ if comment != None:
+ new_config.comment = comment
+ if origin_access_identity != None:
+ new_config.origin_access_identity = origin_access_identity
+ if trusted_signers:
+ new_config.trusted_signers = trusted_signers
+ self.etag = self.connection.set_distribution_config(self.id, self.etag, new_config)
+ self.config = new_config
+ self._object_class = Object
+
+ def enable(self):
+ """
+ Deactivate the Distribution. A convenience wrapper around
+ the update method.
+ """
+ self.update(enabled=True)
+
+ def disable(self):
+ """
+ Activate the Distribution. A convenience wrapper around
+ the update method.
+ """
+ self.update(enabled=False)
+
+ def delete(self):
+ """
+ Delete this CloudFront Distribution. The content
+ associated with the Distribution is not deleted from
+ the underlying Origin bucket in S3.
+ """
+ self.connection.delete_distribution(self.id, self.etag)
+
+ def _get_bucket(self):
+ if not self._bucket:
+ bucket_name = self.config.origin.split('.')[0]
+ from boto.s3.connection import S3Connection
+ s3 = S3Connection(self.connection.aws_access_key_id,
+ self.connection.aws_secret_access_key,
+ proxy=self.connection.proxy,
+ proxy_port=self.connection.proxy_port,
+ proxy_user=self.connection.proxy_user,
+ proxy_pass=self.connection.proxy_pass)
+ self._bucket = s3.get_bucket(bucket_name)
+ self._bucket.distribution = self
+ self._bucket.set_key_class(self._object_class)
+ return self._bucket
+
+ def get_objects(self):
+ """
+ Return a list of all content objects in this distribution.
+
+ :rtype: list of :class:`boto.cloudfront.object.Object`
+ :return: The content objects
+ """
+ bucket = self._get_bucket()
+ objs = []
+ for key in bucket:
+ objs.append(key)
+ return objs
+
+ def set_permissions(self, object, replace=False):
+ """
+ Sets the S3 ACL grants for the given object to the appropriate
+ value based on the type of Distribution. If the Distribution
+ is serving private content the ACL will be set to include the
+ Origin Access Identity associated with the Distribution. If
+ the Distribution is serving public content the content will
+ be set up with "public-read".
+
+ :type object: :class:`boto.cloudfront.object.Object`
+ :param enabled: The Object whose ACL is being set
+
+ :type replace: bool
+ :param replace: If False, the Origin Access Identity will be
+ appended to the existing ACL for the object.
+ If True, the ACL for the object will be
+ completely replaced with one that grants
+ READ permission to the Origin Access Identity.
+
+ """
+ if self.config.origin_access_identity:
+ id = self.config.origin_access_identity.split('/')[-1]
+ oai = self.connection.get_origin_access_identity_info(id)
+ policy = object.get_acl()
+ if replace:
+ policy.acl = ACL()
+ policy.acl.add_user_grant('READ', oai.s3_user_id)
+ object.set_acl(policy)
+ else:
+ object.set_canned_acl('public-read')
+
+ def set_permissions_all(self, replace=False):
+ """
+ Sets the S3 ACL grants for all objects in the Distribution
+ to the appropriate value based on the type of Distribution.
+
+ :type replace: bool
+ :param replace: If False, the Origin Access Identity will be
+ appended to the existing ACL for the object.
+ If True, the ACL for the object will be
+ completely replaced with one that grants
+ READ permission to the Origin Access Identity.
+
+ """
+ bucket = self._get_bucket()
+ for key in bucket:
+ self.set_permissions(key)
+
+ def add_object(self, name, content, headers=None, replace=True):
+ """
+ Adds a new content object to the Distribution. The content
+ for the object will be copied to a new Key in the S3 Bucket
+ and the permissions will be set appropriately for the type
+ of Distribution.
+
+ :type name: str or unicode
+ :param name: The name or key of the new object.
+
+ :type content: file-like object
+ :param content: A file-like object that contains the content
+ for the new object.
+
+ :type headers: dict
+ :param headers: A dictionary containing additional headers
+ you would like associated with the new
+ object in S3.
+
+ :rtype: :class:`boto.cloudfront.object.Object`
+ :return: The newly created object.
+ """
+ if self.config.origin_access_identity:
+ policy = 'private'
+ else:
+ policy = 'public-read'
+ bucket = self._get_bucket()
+ object = bucket.new_key(name)
+ object.set_contents_from_file(content, headers=headers, policy=policy)
+ if self.config.origin_access_identity:
+ self.set_permissions(object, replace)
+ return object
+
+class StreamingDistribution(Distribution):
+
+ def __init__(self, connection=None, config=None, domain_name='',
+ id='', last_modified_time=None, status=''):
+ Distribution.__init__(self, connection, config, domain_name,
+ id, last_modified_time, status)
+ self._object_class = StreamingObject
+
+ def startElement(self, name, attrs, connection):
+ if name == 'StreamingDistributionConfig':
+ self.config = StreamingDistributionConfig()
+ return self.config
+ else:
+ return None
+
+ def update(self, enabled=None, cnames=None, comment=None):
+ """
+ Update the configuration of the Distribution.
+
+ :type enabled: bool
+ :param enabled: Whether the Distribution is active or not.
+
+ :type cnames: list of str
+ :param cnames: The DNS CNAME's associated with this
+ Distribution. Maximum of 10 values.
+
+ :type comment: str or unicode
+ :param comment: The comment associated with the Distribution.
+
+ """
+ new_config = StreamingDistributionConfig(self.connection,
+ self.config.origin,
+ self.config.enabled,
+ self.config.caller_reference,
+ self.config.cnames,
+ self.config.comment)
+ if enabled != None:
+ new_config.enabled = enabled
+ if cnames != None:
+ new_config.cnames = cnames
+ if comment != None:
+ new_config.comment = comment
+
+ self.etag = self.connection.set_streaming_distribution_config(self.id,
+ self.etag,
+ new_config)
+ self.config = new_config
+
+ def delete(self):
+ self.connection.delete_streaming_distribution(self.id, self.etag)
+
+
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/exception.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/cloudfront/exception.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/exception.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/exception.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/cloudfront/exception.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/identity.py Sun Jun 5 08:34:02 2011
@@ -0,0 +1,98 @@
+# 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
+# "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.
+
+import uuid
+
+class OriginAccessIdentity:
+
+ def __init__(self, connection=None, config=None, id='',
+ s3_user_id='', comment=''):
+ self.connection = connection
+ self.config = config
+ self.id = id
+ self.s3_user_id = s3_user_id
+ self.comment = comment
+ self.etag = None
+
+ def startElement(self, name, attrs, connection):
+ if name == 'CloudFrontOriginAccessIdentityConfig':
+ self.config = OriginAccessIdentityConfig()
+ return self.config
+ else:
+ 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 update(self, comment=None):
+ new_config = OriginAccessIdentifyConfig(self.connection,
+ self.config.caller_reference,
+ self.config.comment)
+ if comment != None:
+ new_config.comment = comment
+ self.etag = self.connection.set_origin_identity_config(self.id, self.etag, new_config)
+ self.config = new_config
+
+ def delete(self):
+ return self.connection.delete_distribution(self.id, self.etag)
+
+ def uri(self):
+ return 'origin-access-identity/cloudfront/%s' % id
+
+class OriginAccessIdentityConfig:
+
+ def __init__(self, connection=None, caller_reference='', comment=''):
+ self.connection = connection
+ if caller_reference:
+ self.caller_reference = caller_reference
+ else:
+ self.caller_reference = str(uuid.uuid4())
+ self.comment = comment
+
+ def to_xml(self):
+ s = '<?xml version="1.0" encoding="UTF-8"?>\n'
+ s += '<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2009-09-09/">\n'
+ s += ' <CallerReference>%s</CallerReference>\n' % self.caller_reference
+ if self.comment:
+ s += ' <Comment>%s</Comment>\n' % self.comment
+ s += '</CloudFrontOriginAccessIdentityConfig>\n'
+ return s
+
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'Comment':
+ self.comment = value
+ elif name == 'CallerReference':
+ self.caller_reference = value
+ else:
+ setattr(self, name, value)
+
+
+
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/s3/prefix.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/s3/prefix.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/s3/prefix.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/logging.py Sun Jun 5 08:34:02 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2006,2007 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
@@ -19,17 +19,20 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-class Prefix:
- def __init__(self, bucket=None, name=None):
- self.bucket = bucket
- self.name = name
+class LoggingInfo(object):
+ def __init__(self, bucket='', prefix=''):
+ self.bucket = bucket
+ self.prefix = prefix
+
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
- if name == 'Prefix':
- self.name = value
+ if name == 'Bucket':
+ self.bucket = value
+ elif name == 'Prefix':
+ self.prefix = value
else:
setattr(self, name, value)
-
+
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/cloudwatch/datapoint.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/cloudwatch/datapoint.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/cloudwatch/datapoint.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/object.py Sun Jun 5 08:34:02 2011
@@ -18,20 +18,31 @@
# 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.
-#
-class Datapoint(dict):
+from boto.s3.key import Key
- def __init__(self, connection=None):
- dict.__init__(self)
- self.connection = connection
-
- def startElement(self, name, attrs, connection):
- pass
-
- def endElement(self, name, value, connection):
- if name in ['Average', 'Maximum', 'Minimum', 'Samples', 'Sum']:
- self[name] = float(value)
- elif name != 'member':
- self[name] = value
-
+class Object(Key):
+
+ def __init__(self, bucket, name=None):
+ Key.__init__(self, bucket, name=name)
+ self.distribution = bucket.distribution
+
+ def __repr__(self):
+ return '<Object: %s/%s>' % (self.distribution.config.origin, self.name)
+
+ def url(self, scheme='http'):
+ url = '%s://' % scheme
+ url += self.distribution.domain_name
+ if scheme.lower().startswith('rtmp'):
+ url += '/cfx/st/'
+ else:
+ url += '/'
+ url += self.name
+ return url
+
+class StreamingObject(Object):
+
+ def url(self, scheme='rtmp'):
+ return Object.url(self, scheme)
+
+
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/elb/instancestate.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/elb/instancestate.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/elb/instancestate.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/cloudfront/signers.py Sun Jun 5 08:34:02 2011
@@ -14,41 +14,47 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-class InstanceState(object):
- """
- Represents the state of an EC2 Load Balancer Instance
- """
-
- def __init__(self, load_balancer=None, description=None,
- state=None, instance_id=None, reason_code=None):
- self.load_balancer = load_balancer
- self.description = description
- self.state = state
- self.instance_id = instance_id
- self.reason_code = reason_code
-
- def __repr__(self):
- return 'InstanceState:(%s,%s)' % (self.instance_id, self.state)
+class Signer:
+ def __init__(self):
+ self.id = None
+ self.key_pair_ids = []
+
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
- if name == 'Description':
- self.description = value
- elif name == 'State':
- self.state = value
- elif name == 'InstanceId':
- self.instance_id = value
- elif name == 'ReasonCode':
- self.reason_code = value
- else:
- setattr(self, name, value)
+ if name == 'Self':
+ self.id = 'Self'
+ elif name == 'AwsAccountNumber':
+ self.id = value
+ elif name == 'KeyPairId':
+ self.key_pair_ids.append(value)
+
+class ActiveTrustedSigners(list):
+
+ def startElement(self, name, attrs, connection):
+ if name == 'Signer':
+ s = Signer()
+ self.append(s)
+ return s
+
+ def endElement(self, name, value, connection):
+ pass
+class TrustedSigners(list):
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == 'Self':
+ self.append(name)
+ elif name == 'AwsAccountNumber':
+ self.append(value)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/connection.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/connection.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/connection.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/connection.py Sun Jun 5 08:34:02 2011
@@ -1,5 +1,6 @@
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2008 rPath, Inc.
+# Copyright (c) 2009 The Echo Nest Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -47,6 +48,7 @@ import time
import urllib, urlparse
import os
import xml.sax
+import Queue
import boto
from boto.exception import AWSConnectionError, BotoClientError, BotoServerError
from boto.resultset import ResultSet
@@ -84,44 +86,57 @@ except ImportError:
PORTS_BY_SECURITY = { True: 443, False: 80 }
+class ConnectionPool:
+ def __init__(self, hosts, connections_per_host):
+ self._hosts = boto.utils.LRUCache(hosts)
+ self.connections_per_host = connections_per_host
+
+ def __getitem__(self, key):
+ if key not in self._hosts:
+ self._hosts[key] = Queue.Queue(self.connections_per_host)
+ return self._hosts[key]
+
+ def __repr__(self):
+ return 'ConnectionPool:%s' % ','.join(self._hosts._dict.keys())
+
class AWSAuthConnection:
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='/'):
"""
- @type host: string
- @param host: The host to make the connection to
+ :type host: string
+ :param host: The host to make the connection to
- @type aws_access_key_id: string
- @param aws_access_key_id: AWS Access Key ID (provided by Amazon)
+ :type aws_access_key_id: string
+ :param aws_access_key_id: AWS Access Key ID (provided by Amazon)
- @type aws_secret_access_key: string
- @param aws_secret_access_key: Secret Access Key (provided by Amazon)
+ :type aws_secret_access_key: string
+ :param aws_secret_access_key: Secret Access Key (provided by Amazon)
- @type is_secure: boolean
- @param is_secure: Whether the connection is over SSL
+ :type is_secure: boolean
+ :param is_secure: Whether the connection is over SSL
- @type https_connection_factory: list or tuple
- @param https_connection_factory: A pair of an HTTP connection
+ :type https_connection_factory: list or tuple
+ :param https_connection_factory: A pair of an HTTP connection
factory and the exceptions to catch.
The factory should have a similar
interface to L{httplib.HTTPSConnection}.
- @type proxy:
- @param proxy:
+ :type proxy:
+ :param proxy:
- @type proxy_port: int
- @param proxy_port: The port to use when connecting over a proxy
+ :type proxy_port: int
+ :param proxy_port: The port to use when connecting over a proxy
- @type proxy_user: string
- @param proxy_user: The username to connect with on the proxy
+ :type proxy_user: string
+ :param proxy_user: The username to connect with on the proxy
- @type proxy_pass: string
- @param proxy_pass: The password to use when connection over a proxy.
+ :type proxy_pass: string
+ :param proxy_pass: The password to use when connection over a proxy.
- @type port: integer
- @param port: The port to use to connect
+ :type port: integer
+ :param port: The port to use to connect
"""
self.num_retries = 5
@@ -172,11 +187,26 @@ class AWSAuthConnection:
else:
self.hmac_256 = None
- # cache up to 20 connections
- self._cache = boto.utils.LRUCache(20)
- self.refresh_http_connection(self.host, self.is_secure)
+ # cache up to 20 connections per host, up to 20 hosts
+ self._pool = ConnectionPool(20, 20)
+ self._connection = (self.server_name(), self.is_secure)
self._last_rs = None
+ def __repr__(self):
+ return '%s:%s' % (self.__class__.__name__, self.host)
+
+ def _cached_name(self, host, is_secure):
+ if host is None:
+ host = self.server_name()
+ cached_name = is_secure and 'https://' or 'http://'
+ cached_name += host
+ return cached_name
+
+ def connection(self):
+ return self.get_http_connection(*self._connection)
+
+ connection = property(connection)
+
def get_path(self, path='/'):
pos = path.find('?')
if pos >= 0:
@@ -198,8 +228,10 @@ class AWSAuthConnection:
path = path + params
return path
- def server_name(self):
- if self.port == 80:
+ def server_name(self, port=None):
+ if not port:
+ port = self.port
+ if port == 80:
signature_host = self.host
else:
# This unfortunate little hack can be attributed to
@@ -208,10 +240,10 @@ class AWSAuthConnection:
# in the Host header and so we needed to make sure we
# did the same when calculating the V2 signature. In 2.6
# it no longer does that. Hence, this kludge.
- if sys.version[:3] == "2.6" and self.port == 443:
+ if sys.version[:3] == "2.6" and port == 443:
signature_host = self.host
else:
- signature_host = '%s:%d' % (self.host, self.port)
+ signature_host = '%s:%d' % (self.host, port)
return signature_host
def handle_proxy(self, proxy, proxy_port, proxy_user, proxy_pass):
@@ -249,15 +281,13 @@ class AWSAuthConnection:
self.use_proxy = (self.proxy != None)
def get_http_connection(self, host, is_secure):
- if host is None:
- host = self.server_name()
- cached_name = is_secure and 'https://' or 'http://'
- cached_name += host
- if cached_name in self._cache:
- return self._cache[cached_name]
- return self.refresh_http_connection(host, is_secure)
+ queue = self._pool[self._cached_name(host, is_secure)]
+ try:
+ return queue.get_nowait()
+ except Queue.Empty:
+ return self.new_http_connection(host, is_secure)
- def refresh_http_connection(self, host, is_secure):
+ def new_http_connection(self, host, is_secure):
if self.use_proxy:
host = '%s:%d' % (self.proxy, int(self.proxy_port))
if host is None:
@@ -274,17 +304,20 @@ class AWSAuthConnection:
connection = httplib.HTTPConnection(host)
if self.debug > 1:
connection.set_debuglevel(self.debug)
- cached_name = is_secure and 'https://' or 'http://'
- cached_name += host
- if cached_name in self._cache:
- boto.log.debug('closing old HTTP connection')
- self._cache[cached_name].close()
- self._cache[cached_name] = connection
- # update self.connection for backwards-compatibility
+ # self.connection must be maintained for backwards-compatibility
+ # however, it must be dynamically pulled from the connection pool
+ # set a private variable which will enable that
if host.split(':')[0] == self.host and is_secure == self.is_secure:
- self.connection = connection
+ self._connection = (host, is_secure)
return connection
+ def put_http_connection(self, host, is_secure, connection):
+ try:
+ self._pool[self._cached_name(host, is_secure)].put_nowait(connection)
+ except Queue.Full:
+ # gracefully fail in case of pool overflow
+ connection.close()
+
def proxy_ssl(self):
host = '%s:%d' % (self.host, self.port)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -311,15 +344,20 @@ class AWSAuthConnection:
# We can safely close the response, it duped the original socket
resp.close()
- # Wrap the socket in an SSL socket
- sslSock = socket.ssl(sock, None, None)
h = httplib.HTTPConnection(host)
+
+ # Wrap the socket in an SSL socket
+ if hasattr(httplib, 'ssl'):
+ sslSock = httplib.ssl.SSLSocket(sock)
+ else: # Old Python, no ssl module
+ sslSock = socket.ssl(sock, None, None)
+ sslSock = httplib.FakeSocket(sock, sslSock)
# This is a bit unclean
- h.sock = httplib.FakeSocket(sock, sslSock)
+ h.sock = sslSock
return h
def prefix_proxy_to_path(self, path, host=None):
- path = self.protocol + '://' + (host or self.host) + path
+ path = self.protocol + '://' + (host or self.server_name()) + path
return path
def get_proxy_auth_header(self):
@@ -371,6 +409,7 @@ class AWSAuthConnection:
print '-------------------------'
elif response.status < 300 or response.status >= 400 or \
not location:
+ self.put_http_connection(host, self.is_secure, connection)
return response
else:
scheme, host, path, params, query, fragment = \
@@ -386,7 +425,7 @@ class AWSAuthConnection:
except self.http_exceptions, e:
boto.log.debug('encountered %s exception, reconnecting' % \
e.__class__.__name__)
- connection = self.refresh_http_connection(host, self.is_secure)
+ connection = self.new_http_connection(host, self.is_secure)
time.sleep(2**i)
i += 1
# If we made it here, it's because we have exhausted our retries and stil haven't
@@ -403,9 +442,10 @@ class AWSAuthConnection:
auth_path=None, sender=None):
path = self.get_path(path)
if headers == None:
- headers = {'User-Agent' : UserAgent}
+ headers = {}
else:
headers = headers.copy()
+ headers['User-Agent'] = UserAgent
if not headers.has_key('Content-Length'):
headers['Content-Length'] = str(len(data))
if self.use_proxy:
@@ -431,6 +471,18 @@ class AWSAuthConnection:
b64_hmac = base64.encodestring(hmac.digest()).strip()
headers['Authorization'] = "AWS %s:%s" % (self.aws_access_key_id, b64_hmac)
+ def close(self):
+ """(Optional) Close any open HTTP connections. This is non-destructive,
+ and making a new request will open a connection again."""
+
+ 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):
APIVersion = ''
@@ -518,8 +570,7 @@ class AWSQueryConnection(AWSAuthConnecti
return t
def make_request(self, action, params=None, path='/', verb='GET'):
- path = self.get_path(path)
- headers = {'User-Agent' : UserAgent}
+ headers = {}
if params == None:
params = {}
params['Action'] = action
@@ -527,17 +578,17 @@ class AWSQueryConnection(AWSAuthConnecti
params['AWSAccessKeyId'] = self.aws_access_key_id
params['SignatureVersion'] = self.SignatureVersion
params['Timestamp'] = time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime())
- qs, signature = self.get_signature(params, verb, path)
+ qs, signature = self.get_signature(params, verb, self.get_path(path))
if verb == 'POST':
- headers['Content-Type'] = 'application/x-www-form-urlencoded'
+ headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
request_body = qs + '&Signature=' + urllib.quote(signature)
qs = path
else:
- request_body = None
+ request_body = ''
qs = path + '?' + qs + '&Signature=' + urllib.quote(signature)
- if self.use_proxy:
- qs = self.prefix_proxy_to_path(qs)
- return self._mexe(verb, qs, request_body, headers)
+ return AWSAuthConnection.make_request(self, verb, qs,
+ data=request_body,
+ headers=headers)
def build_list_params(self, params, items, label):
if isinstance(items, str):
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/m2helpers.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/m2helpers.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/m2helpers.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/m2helpers.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/m2helpers.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/ymlmessage.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/contrib/ymlmessage.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/contrib/ymlmessage.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/__init__.py Sun Jun 5 08:34:02 2011
@@ -32,8 +32,8 @@ def regions(**kw_params):
object's constructor as keyword arguments and they will be
passed along to the EC2Connection object.
- @rtype: list
- @return: A list of L{RegionInfo<boto.ec2.regioninfo.RegionInfo>}
+ :rtype: list
+ :return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
"""
c = EC2Connection(**kw_params)
return c.get_all_regions()
@@ -44,3 +44,9 @@ def connect_to_region(region_name, **kw_
return region.connect(**kw_params)
return None
+def get_region(region_name, **kw_params):
+ for region in regions(**kw_params):
+ if region.name == region_name:
+ return region
+ return None
+
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/address.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/address.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/address.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/__init__.py Sun Jun 5 08:34:02 2011
@@ -82,9 +82,13 @@ class AutoScaleConnection(AWSQueryConnec
'MaxSize' : as_group.max_size,
}
if op.startswith('Create'):
+ if as_group.availability_zones:
+ zones = self.availability_zones
+ else:
+ zones = [as_group.availability_zone]
self.build_list_params(params, as_group.load_balancers,
'LoadBalancerNames')
- self.build_list_params(params, [as_group.availability_zone],
+ self.build_list_params(params, zones,
'AvailabilityZones')
return self.get_object(op, params, Request)
@@ -98,8 +102,8 @@ class AutoScaleConnection(AWSQueryConnec
"""
Creates a new Launch Configuration.
- @type launch_config: boto.ec2.autoscale.launchconfig.LaunchConfiguration
- @param launch_config: LaunchConfiguraiton object.
+ :type launch_config: boto.ec2.autoscale.launchconfig.LaunchConfiguration
+ :param launch_config: LaunchConfiguraiton object.
"""
params = {
@@ -146,6 +150,7 @@ class AutoScaleConnection(AWSQueryConnec
req = self.get_object('CreateOrUpdateScalingTrigger', params,
Request)
+ return req
def get_all_groups(self, names=None):
"""
@@ -171,11 +176,11 @@ class AutoScaleConnection(AWSQueryConnec
"""
Get all activities for the given autoscaling group.
- @type autoscale_group: str or AutoScalingGroup object
- @param autoscale_group: The auto scaling group to get activities on.
+ :type autoscale_group: str or AutoScalingGroup object
+ :param autoscale_group: The auto scaling group to get activities on.
@max_records: int
- @param max_records: Maximum amount of activities to return.
+ :param max_records: Maximum amount of activities to return.
"""
name = autoscale_group
if isinstance(autoscale_group, AutoScalingGroup):
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/activity.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/activity.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/activity.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/activity.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/activity.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/group.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/group.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/group.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/group.py Sun Jun 5 08:34:02 2011
@@ -21,6 +21,7 @@
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
@@ -47,6 +48,7 @@ class Instance(object):
class AutoScalingGroup(object):
def __init__(self, connection=None, group_name=None,
availability_zone=None, launch_config=None,
+ availability_zones=None,
load_balancers=None, cooldown=0,
min_size=None, max_size=None):
"""
@@ -57,30 +59,36 @@ class AutoScalingGroup(object):
creation request is completed, the AutoScalingGroup is ready to be
used in other calls.
- @type name: str
- @param name: Name of autoscaling group.
+ :type name: str
+ :param name: Name of autoscaling group.
- @type availability_zone: str
- @param availability_zone: An availability zone.
+ :type availability_zone: str
+ :param availability_zone: An availability zone. DEPRECATED - use the
+ availability_zones parameter, which expects
+ a list of availability zone
+ strings
- @type launch_config: str
- @param launch_config: Name of launch configuration name.
+ :type availability_zone: list
+ :param availability_zone: List of availability zones.
- @type load_balancers: list
- @param load_balancers: List of load balancers.
+ :type launch_config: str
+ :param launch_config: Name of launch configuration name.
- @type minsize: int
- @param minsize: Minimum size of group
+ :type load_balancers: list
+ :param load_balancers: List of load balancers.
- @type maxsize: int
- @param maxsize: Maximum size of group
+ :type minsize: int
+ :param minsize: Minimum size of group
- @type cooldown: int
- @param cooldown: Amount of time after a Scaling Activity completes
+ :type maxsize: int
+ :param maxsize: Maximum size of group
+
+ :type cooldown: int
+ :param cooldown: Amount of time after a Scaling Activity completes
before any further scaling activities can start.
- @rtype: tuple
- @return: Updated healthcheck for the instances.
+ :rtype: tuple
+ :return: Updated healthcheck for the instances.
"""
self.name = group_name
self.connection = connection
@@ -96,7 +104,9 @@ class AutoScalingGroup(object):
self.desired_capacity = None
lbs = load_balancers or []
self.load_balancers = ListElement(lbs)
+ zones = availability_zones or []
self.availability_zone = availability_zone
+ self.availability_zones = ListElement(zones)
self.instances = None
def __repr__(self):
@@ -108,6 +118,8 @@ class AutoScalingGroup(object):
return self.instances
elif name == 'LoadBalancerNames':
return self.load_balancers
+ elif name == 'AvailabilityZones':
+ return self.availability_zones
else:
return
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/instance.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/instance.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/instance.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/launchconfig.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/launchconfig.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/launchconfig.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/launchconfig.py Sun Jun 5 08:34:02 2011
@@ -32,18 +32,18 @@ class LaunchConfiguration(object):
"""
A launch configuration.
- @type name: str
- @param name: Name of the launch configuration to create.
+ :type name: str
+ :param name: Name of the launch configuration to create.
- @type image_id: str
- @param image_id: Unique ID of the Amazon Machine Image (AMI) which was
+ :type image_id: str
+ :param image_id: Unique ID of the Amazon Machine Image (AMI) which was
assigned during registration.
- @type key_name: str
- @param key_name: The name of the EC2 key pair.
+ :type key_name: str
+ :param key_name: The name of the EC2 key pair.
- @type security_groups: list
- @param security_groups: Names of the security groups with which to
+ :type security_groups: list
+ :param security_groups: Names of the security groups with which to
associate the EC2 instances.
"""
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/request.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/request.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/request.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/request.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/request.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/trigger.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/trigger.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/autoscale/trigger.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/autoscale/trigger.py Sun Jun 5 08:34:02 2011
@@ -27,41 +27,8 @@ from boto.ec2.autoscale.request import R
class Trigger(object):
"""
An auto scaling trigger.
-
- @type name: str
- @param name: The name for this trigger
-
- @type autoscale_group: str
- @param autoscale_group: The name of the AutoScalingGroup that will be
- associated with the trigger. The AutoScalingGroup
- that will be affected by the trigger when it is
- activated.
-
- @type dimensions: list
- @param dimensions: List of tuples, i.e.
- ('ImageId', 'i-13lasde') etc.
-
- @type measure_name: str
- @param measure_name: The measure name associated with the metric used by
- the trigger to determine when to activate, for
- example, CPU, network I/O, or disk I/O.
-
- @type statistic: str
- @param statistic: The particular statistic used by the trigger when
- fetching metric statistics to examine.
-
- @type period: int
- @param period: The period associated with the metric statistics in
- seconds. Valid Values: 60 or a multiple of 60.
-
- @type unit:
- @param unit
-
- @type lower_threshold:
- @param lower_threshold
-
-
"""
+
def __init__(self, connection=None, name=None, autoscale_group=None,
dimensions=None, measure_name=None,
statistic=None, unit=None, period=60,
@@ -70,6 +37,41 @@ class Trigger(object):
upper_threshold=None,
upper_breach_scale_increment=None,
breach_duration=None):
+ """
+ Initialize an auto-scaling trigger object.
+
+ :type name: str
+ :param name: The name for this trigger
+
+ :type autoscale_group: str
+ :param autoscale_group: The name of the AutoScalingGroup that will be
+ associated with the trigger. The AutoScalingGroup
+ that will be affected by the trigger when it is
+ activated.
+
+ :type dimensions: list
+ :param dimensions: List of tuples, i.e.
+ ('ImageId', 'i-13lasde') etc.
+
+ :type measure_name: str
+ :param measure_name: The measure name associated with the metric used by
+ the trigger to determine when to activate, for
+ example, CPU, network I/O, or disk I/O.
+
+ :type statistic: str
+ :param statistic: The particular statistic used by the trigger when
+ fetching metric statistics to examine.
+
+ :type period: int
+ :param period: The period associated with the metric statistics in
+ seconds. Valid Values: 60 or a multiple of 60.
+
+ :type unit:
+ :param unit
+
+ :type lower_threshold:
+ :param lower_threshold
+ """
self.name = name
self.connection = connection
self.dimensions = dimensions
Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/blockdevicemapping.py Sun Jun 5 08:34:02 2011
@@ -0,0 +1,89 @@
+# Copyright (c) 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
+# "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.
+#
+
+class EBSBlockDeviceType(object):
+
+ def __init__(self, connection=None):
+ self.connection = connection
+ self.volume_id = None
+ self.snapshot_id = None
+ self.status = None
+ self.attach_time = None
+ self.delete_on_termination = False
+ self.size = None
+
+ def startElement(self, name, attrs, connection):
+ pass
+
+ def endElement(self, name, value, connection):
+ if name =='volumeId':
+ self.volume_id = value
+ elif name =='snapshotId':
+ self.snapshot_id = value
+ elif name == 'volumeSize':
+ self.size = int(value)
+ elif name == 'status':
+ self.status = value
+ elif name == 'attachTime':
+ self.attach_time = value
+ elif name == 'deleteOnTermination':
+ if value == 'true':
+ self.delete_on_termination = True
+ else:
+ self.delete_on_termination = False
+ else:
+ setattr(self, name, value)
+
+class BlockDeviceMapping(dict):
+
+ def __init__(self, connection=None):
+ dict.__init__(self)
+ self.connection = connection
+ self.current_name = None
+ self.current_value = None
+
+ def startElement(self, name, attrs, connection):
+ if name == 'ebs':
+ self.current_value = EBSBlockDeviceType(self)
+ return self.current_value
+
+ def endElement(self, name, value, connection):
+ if name == 'device' or name == 'deviceName':
+ self.current_name = value
+ elif name == 'item':
+ self[self.current_name] = self.current_value
+
+ def build_list_params(self, params, prefix=''):
+ i = 1
+ for dev_name in self:
+ pre = '%sBlockDeviceMapping.%d' % (pre, 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'
+ else:
+ params['%s.Ebs.DeleteOnTermination' % pre] = 'false'
+ i += 1
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/buyreservation.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/ec2/buyreservation.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/ec2/buyreservation.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)