mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1132067 [5/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...
Date Sun, 05 Jun 2011 08:34:13 GMT
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/notification.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/notification.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/notification.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/notification.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/notification.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/notification.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/notification.py Sun Jun  5 08:34:02 2011
@@ -14,7 +14,7 @@
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
@@ -25,21 +25,24 @@ implementations of the Mechanical Turk N
 """
 
 import hmac
-import sha
+try:
+    from hashlib import sha1 as sha
+except ImportError:
+    import sha
 import base64
 import re
 
 class NotificationMessage:
-    
+
     NOTIFICATION_WSDL = "http://mechanicalturk.amazonaws.com/AWSMechanicalTurk/2006-05-05/AWSMechanicalTurkRequesterNotification.wsdl"
     NOTIFICATION_VERSION = '2006-05-05'
-    
+
     SERVICE_NAME = "AWSMechanicalTurkRequesterNotification"
     OPERATION_NAME = "Notify"
-    
+
     EVENT_PATTERN = r"Event\.(?P<n>\d+)\.(?P<param>\w+)"
     EVENT_RE = re.compile(EVENT_PATTERN)
-    
+
     def __init__(self, d):
         """
         Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message
@@ -48,7 +51,7 @@ class NotificationMessage:
         self.timestamp = d['Timestamp'] # 2006-05-23T23:22:30Z
         self.version = d['Version'] # 2006-05-05
         assert d['method'] == NotificationMessage.OPERATION_NAME, "Method should be '%s'" % NotificationMessage.OPERATION_NAME
-        
+
         # Build Events
         self.events = []
         events_dict = {}
@@ -67,7 +70,7 @@ class NotificationMessage:
                     events_dict[n][param] = v
         for n in events_dict:
             self.events.append(Event(events_dict[n]))
-    
+
     def verify(self, secret_key):
         """
         Verifies the authenticity of a notification message.
@@ -85,8 +88,8 @@ class Event:
         self.hit_type = d['HITTypeId']
         self.hit_id = d['HITId']
         self.assignment_id = d['AssignmentId']
-        
+
         #TODO: build self.event_time datetime from string self.event_time_str
-        
+
     def __repr__(self):
         return "<boto.mturk.notification.Event: %s for HIT # %s>" % (self.event_type, self.hit_id)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/price.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/price.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/price.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/price.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/price.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/qualification.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/qualification.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/qualification.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/qualification.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/qualification.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/question.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/question.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/question.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/question.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/question.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/question.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/question.py Sun Jun  5 08:34:02 2011
@@ -70,22 +70,90 @@ class ExternalQuestion(object):
                                                 self.frame_height)
         return ret
 
+class OrderedContent(object):
+    def __init__(self):
+        self.items = []
+
+    def append(self, field, value):
+        "Expects field type and value"
+        self.items.append((field, value))
 
+    def get_binary_xml(self, field, value):
+        return """
+<Binary>
+  <MimeType>
+    <Type>%s</Type>
+    <SubType>%s</SubType>
+  </MimeType>
+  <DataURL>%s</DataURL>
+  <AltText>%s</AltText>
+</Binary>""" % (value['binary_type'],
+                value['binary_subtype'],
+                value['binary'],
+                value['binary_alttext'])
+    
+    def get_application_xml(self, field, value):
+        raise NotImplementedError("Application question content is not yet supported.")
+
+    def get_as_xml(self):
+        default_handler = lambda f,v: '<%s>%s</%s>' % (f,v,f)
+        bulleted_list_handler = lambda _,list: '<List>%s</List>' % ''.join([('<ListItem>%s</ListItem>' % item) for item in list])
+        formatted_content_handler = lambda _,content: "<FormattedContent><![CDATA[%s]]></FormattedContent>" % content
+        application_handler = self.get_application_xml
+        binary_handler = self.get_binary_xml
+        
+        children = ''
+        for (field,value) in self.items:
+            handler = default_handler
+            if field == 'List':
+                handler = bulleted_list_handler
+            elif field == 'Application':
+                handler = application_handler
+            elif field == 'Binary':
+                handler = binary_handler
+            elif field == 'FormattedContent':
+                handler = formatted_content_handler
+            children = children + handler(field, value)
+
+        return children    
+
+class Overview(object):
+    OVERVIEW_XML_TEMPLATE = """<Overview>%s</Overview>"""
+    
+    def __init__(self):
+        self.ordered_content = OrderedContent()
+
+    def append(self, field, value):
+        self.ordered_content.append(field,value)
+    
+    def get_as_params(self, label='Overview'):
+        return { label : self.get_as_xml() }
+    
+    def get_as_xml(self):
+        ret = Overview.OVERVIEW_XML_TEMPLATE % (self.ordered_content.get_as_xml())
+
+        return ret
+    
 
 class QuestionForm(object):
     
     QUESTIONFORM_SCHEMA_LOCATION = "http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd"
     QUESTIONFORM_XML_TEMPLATE = """<QuestionForm xmlns="%s">%s</QuestionForm>""" # % (ns, questions_xml)
     
-    def __init__(self, questions=None):
+    def __init__(self, questions=None, overview=None):
         if questions is None or type(questions) is not list:
             raise ValueError("Must pass a list of Question instances to QuestionForm constructor")
         else:
             self.questions = questions
+        self.overview = overview
+
     
     def get_as_xml(self):
+        if self.overview:
+            overview_xml = self.overview.get_as_xml()
         questions_xml = "".join([q.get_as_xml() for q in self.questions])
-        return QuestionForm.QUESTIONFORM_XML_TEMPLATE % (QuestionForm.QUESTIONFORM_SCHEMA_LOCATION, questions_xml)
+        qf_xml = overview_xml + questions_xml
+        return QuestionForm.QUESTIONFORM_XML_TEMPLATE % (QuestionForm.QUESTIONFORM_SCHEMA_LOCATION, qf_xml)
     
     #def startElement(self, name, attrs, connection):
     #    return None
@@ -102,78 +170,19 @@ class QuestionForm(object):
     #    pass # What's this method for?  I don't get it.
 
 class QuestionContent(object):
+    QUESTIONCONTENT_XML_TEMPLATE = """<QuestionContent>%s</QuestionContent>"""
     
-    def __init__(self, title=None, text=None, bulleted_list=None, 
-                 binary=None, binary_type=None, binary_subtype=None, binary_alttext=None,
-                 application=None, formatted_content=None):
-        if binary:
-            # TODO: attempt to auto-detect mimetype from binary url
-            assert (binary_type and binary_subtype and binary_alttext), "Type, subtype and alttext are required for binary alements"
-        self.title = title
-        self.text = text
-        self.bulleted_list = bulleted_list
-        self.binary = binary
-        self.binary_type = binary_type
-        self.binary_subtype = binary_subtype
-        self.binary_alttext = binary_alttext
-        self.application = application
-        self.formatted_content = formatted_content
-        
-    def get_title_xml(self):
-        if self.title is None:
-            return '' # empty
-        else:
-            return "<Title>%s</Title>" % self.title
-    
-    def get_text_xml(self):
-        if self.text is None:
-            return ''
-        else:
-            return "<Text>%s</Text>" % self.text
-    
-    def get_bulleted_list_xml(self):
-        if self.bulleted_list is None:
-            return ''
-        elif type(self.bulleted_list) is list:
-            return "<List>%s</List>" % self.get_bulleted_list_items_xml()
-        else:
-            raise ValueError("QuestionContent bulleted_list argument should be a list.")
-    
-    def get_bulleted_list_items_xml(self):
-        ret = ""
-        for item in self.bulleted_list:
-            ret = ret + "<ListItem>%s</ListItem>" % item
-        return ret
-    
-    def get_binary_xml(self):
-        if self.binary is None:
-            return ''
-        else:
-            return """
-<Binary>
-  <MimeType>
-    <Type>%s</Type>
-    <SubType>%s</SubType>
-  </MimeType>
-  <DataURL>%s</DataURL>
-  <AltText>%s</AltText>
-</Binary>""" %(self.binary_type, self.binary_subtype, self.binary, self.binary_alttext )
-    
-    def get_application_xml(self):
-        if self.application is None:
-            return ''
-        else:
-            raise NotImplementedError("Application question content is not yet supported.")
-    
-    def get_formatted_content_xml(self):
-        if self.formatted_content is None:
-            return ''
-        else:
-            return "<FormattedContent><![CDATA[%s]]></FormattedContent>" % self.formatted_content
+    def __init__(self):
+        self.ordered_content = OrderedContent()
+
+    def append(self, field, value):
+        self.ordered_content.append(field,value)
     
     def get_as_xml(self):
-        children = self.get_title_xml() + self.get_text_xml() + self.get_bulleted_list_xml() + self.get_binary_xml() + self.get_application_xml() + self.get_formatted_content_xml()
-        return "<QuestionContent>%s</QuestionContent>" % children
+        ret = QuestionContent.QUESTIONCONTENT_XML_TEMPLATE % (self.ordered_content.get_as_xml())
+
+        return ret
+
 
 class AnswerSpecification(object):
     

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/all_tests.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/all_tests.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/all_tests.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/all_tests.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/all_tests.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/cleanup_tests.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/cleanup_tests.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/cleanup_tests.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/cleanup_tests.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/cleanup_tests.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_free_text_question_regex.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_free_text_question_regex.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_free_text_question_regex.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_free_text_question_regex.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_free_text_question_regex.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_binary.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_binary.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_binary.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_binary.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_binary.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_external.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_external.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_external.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_external.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_external.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_from_hit_type.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_from_hit_type.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_from_hit_type.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_from_hit_type.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_from_hit_type.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_with_qualifications.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_with_qualifications.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_with_qualifications.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/create_hit_with_qualifications.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/create_hit_with_qualifications.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/reviewable_hits.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/reviewable_hits.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/reviewable_hits.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/reviewable_hits.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/reviewable_hits.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/search_hits.doctest (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/search_hits.doctest)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/search_hits.doctest?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/mturk/test/search_hits.doctest&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/mturk/test/search_hits.doctest&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/bootstrap.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/bootstrap.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/bootstrap.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/bootstrap.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/bootstrap.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/config.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/config.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/config.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/config.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/config.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/config.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/config.py Sun Jun  5 08:34:02 2011
@@ -19,7 +19,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 #
-import StringIO, os
+import StringIO, os, re
 import ConfigParser
 import boto
 
@@ -30,6 +30,8 @@ if 'HOME' in os.environ:
     BotoConfigLocations.append(UserConfigPath)
 else:
     UserConfigPath = None
+if 'BOTO_CONFIG' in os.environ:
+    BotoConfigLocations.append(os.path.expanduser(os.environ['BOTO_CONFIG']))
 
 class Config(ConfigParser.SafeConfigParser):
 
@@ -38,11 +40,33 @@ class Config(ConfigParser.SafeConfigPars
                                                       'debug' : '0'})
         if do_load:
             if path:
-                self.read(path)
+                self.load_from_path(path)
             elif fp:
                 self.readfp(fp)
             else:
                 self.read(BotoConfigLocations)
+            if "AWS_CREDENTIAL_FILE" in os.environ:
+                self.load_credential_file(os.path.expanduser(os.environ['AWS_CREDENTIAL_FILE']))
+
+    def load_credential_file(self, path):
+        """Load a credential file as is setup like the Java utilities"""
+        config = ConfigParser.ConfigParser()
+        c_data = StringIO.StringIO()
+        c_data.write("[Credentials]\n")
+        for line in open(path, "r").readlines():
+            c_data.write(line.replace("AWSAccessKeyId", "aws_access_key_id").replace("AWSSecretKey", "aws_secret_access_key"))
+        c_data.seek(0)
+        self.readfp(c_data)
+
+    def load_from_path(self, path):
+        file = open(path)
+        for line in file.readlines():
+            match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
+            if match:
+                extended_file = match.group(1)
+                (dir, file) = os.path.split(path)
+                self.load_from_path(os.path.join(dir, extended_file))
+        self.read(path)
 
     def save_option(self, path, section, option, value):
         """

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.cfg (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/copybot.cfg)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.cfg?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.cfg&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/copybot.cfg&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/copybot.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/copybot.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/copybot.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/helloworld.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/helloworld.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/helloworld.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/helloworld.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/helloworld.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/apache.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/apache.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/apache.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/apache.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/apache.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/ebs.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/ebs.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/ebs.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/ebs.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/ebs.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/ebs.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/ebs.py Sun Jun  5 08:34:02 2011
@@ -24,16 +24,27 @@ Automated installer to attach, format an
 This installer assumes that you want the volume formatted as
 an XFS file system.  To drive this installer, you need the
 following section in the boto config passed to the new instance.
+You also need to install dateutil by listing python-dateutil
+in the list of packages to be installed in the Pyami seciont
+of your boto config file.
+
 If there is already a device mounted at the specified mount point,
 the installer assumes that it is the ephemeral drive and unmounts
 it, remounts it as /tmp and chmods it to 777.
 
-[EBS]
-volume_id = <the id of the EBS volume, should look like vol-xxxxxxxx>
-device = <the linux device the EBS volume should be mounted on
-mount_point = <directory to mount device, defaults to /ebs>
+Config file section::
+
+    [EBS]
+    volume_id = <the id of the EBS volume, should look like vol-xxxxxxxx>
+    logical_volume_name = <the name of the logical volume that contaings 
+        a reference to the physical volume to be mounted. If this parameter
+        is supplied, it overrides the volume_id setting.>
+    device = <the linux device the EBS volume should be mounted on>
+    mount_point = <directory to mount device, defaults to /ebs>
+
 """
 import boto
+from boto.manage.volume import Volume
 import os, time
 from boto.pyami.installers.ubuntu.installer import Installer
 from string import Template
@@ -64,6 +75,13 @@ if __name__ == "__main__":
     b = Backup()
     b.main()
 """
+
+BackupCleanupScript= """#!/usr/bin/env python
+# Cleans Backups of EBS volumes
+
+for v in Volume.all():
+        v.trim_snapshot(True)
+"""
     
 class EBSInstaller(Installer):
     """
@@ -75,10 +93,22 @@ class EBSInstaller(Installer):
         self.instance_id = boto.config.get('Instance', 'instance-id')
         self.device = boto.config.get('EBS', 'device', '/dev/sdp')
         self.volume_id = boto.config.get('EBS', 'volume_id')
+        self.logical_volume_name = boto.config.get('EBS', 'logical_volume_name')
         self.mount_point = boto.config.get('EBS', 'mount_point', '/ebs')
 
     def attach(self):
         ec2 = boto.connect_ec2()
+        if self.logical_volume_name:
+            # if a logical volume was specified, override the specified volume_id
+            # (if there was one) with the current AWS volume for the logical volume:
+            logical_volume = Volume.find(name = self.logical_volume_name).next()
+            self.volume_id = logical_volume._volume_id
+        volume = ec2.get_all_volumes([self.volume_id])[0]
+        # wait for the volume to be available. The volume may still be being created
+        # from a snapshot.
+        while volume.update() != 'available':
+            boto.log.info('Volume %s not yet available. Current status = %s.' % (volume.id, volume.status))
+            time.sleep(5)
         ec2.attach_volume(self.volume_id, self.instance_id, self.device)
         # now wait for the volume device to appear
         while not os.path.exists(self.device):
@@ -100,6 +130,12 @@ class EBSInstaller(Installer):
         fp.close()
         self.run('chmod +x /usr/local/bin/ebs_backup')
 
+    def create_backup_cleanup_script(self):
+        fp = open('/usr/local/bin/ebs_backup_cleanup', 'w')
+        fp.write(BackupCleanupScript)
+        fp.close()
+        self.run('chmod +x /usr/local/bin/ebs_backup_cleanup')
+
     def handle_mount_point(self):
         boto.log.info('handle_mount_point')
         if not os.path.isdir(self.mount_point):
@@ -146,7 +182,16 @@ class EBSInstaller(Installer):
         self.create_backup_script()
 
         # Set up the backup script
-        self.add_cron("ebs_backup", "/usr/local/bin/ebs_backup", minute="0", hour="4,16")
+        minute = boto.config.get('EBS', 'backup_cron_minute', '0')
+        hour = boto.config.get('EBS', 'backup_cron_hour', '4,16')
+        self.add_cron("ebs_backup", "/usr/local/bin/ebs_backup", minute=minute, hour=hour)
+
+        # Set up the backup cleanup script
+        minute = boto.config.get('EBS', 'backup_cleanup_cron_minute')
+        hour = boto.config.get('EBS', 'backup_cleanup_cron_hour')
+        if (minute != None) and (hour != None):
+            self.create_backup_cleanup_script();
+            self.add_cron("ebs_backup_cleanup", "/usr/local/bin/ebs_backup_cleanup", minute=minute, hour=hour)
 
         # Set up the fstab
         self.update_fstab()

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/installer.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/installer.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/installer.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/installer.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/installer.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/installer.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/installer.py Sun Jun  5 08:34:02 2011
@@ -24,6 +24,7 @@ import os
 import os.path
 import stat
 import boto
+import random
 from pwd import getpwnam
 
 class Installer(boto.pyami.installers.Installer):
@@ -36,6 +37,10 @@ class Installer(boto.pyami.installers.In
             env is a dict containing environment variables you want to set in the file
             name will be used as the name of the file
         """
+        if minute == 'random':
+            minute = str(random.randrange(60))
+        if hour == 'random':
+            hour = str(random.randrange(24))
         fp = open('/etc/cron.d/%s' % name, "w")
         if env:
             for key, value in env.items():

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/mysql.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/mysql.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/mysql.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/mysql.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/mysql.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/mysql.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/mysql.py Sun Jun  5 08:34:02 2011
@@ -30,6 +30,7 @@ to the instance.
 from boto.pyami.installers.ubuntu.installer import Installer
 import os
 import boto
+from boto.utils import ShellCommand
 from ConfigParser import SafeConfigParser
 import time
 
@@ -55,15 +56,21 @@ class MySQL(Installer):
     def change_data_dir(self, password=None):
         data_dir = boto.config.get('MySQL', 'data_dir', '/mnt')
         fresh_install = False;
-        time.sleep(10) #trying to stop mysql immediately after installing it fails
-        # We need to wait until mysql creates the root account before we kill it
-        # or bad things will happen
-        i = 0
-        while self.run("echo 'quit' | mysql -u root") != 0 and i<5:
-            time.sleep(5)
-            i = i + 1
-        self.run('/etc/init.d/mysql stop')
-        self.run("pkill -9 mysql")
+        is_mysql_running_command = ShellCommand('mysqladmin ping') # exit status 0 if mysql is running
+        is_mysql_running_command.run()
+        if is_mysql_running_command.getStatus() == 0:
+            # mysql is running. This is the state apt-get will leave it in. If it isn't running, 
+            # that means mysql was already installed on the AMI and there's no need to stop it,
+            # saving 40 seconds on instance startup.
+            time.sleep(10) #trying to stop mysql immediately after installing it fails
+            # We need to wait until mysql creates the root account before we kill it
+            # or bad things will happen
+            i = 0
+            while self.run("echo 'quit' | mysql -u root") != 0 and i<5:
+                time.sleep(5)
+                i = i + 1
+            self.run('/etc/init.d/mysql stop')
+            self.run("pkill -9 mysql")
 
         mysql_path = os.path.join(data_dir, 'mysql')
         if not os.path.exists(mysql_path):

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/trac.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/trac.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/trac.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/installers/ubuntu/trac.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/installers/ubuntu/trac.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/launch_ami.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/launch_ami.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/launch_ami.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/launch_ami.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/launch_ami.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/scriptbase.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/scriptbase.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/scriptbase.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/scriptbase.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/scriptbase.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/scriptbase.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/scriptbase.py Sun Jun  5 08:34:02 2011
@@ -30,9 +30,11 @@ class ScriptBase:
     def run(self, command, notify=True, exit_on_error=False):
         self.last_command = ShellCommand(command)
         if self.last_command.status != 0:
-            boto.log.error(self.last_command.output)
+            boto.log.error('Error running command: "%s". Output: "%s"' % (command, self.last_command.output))
             if notify:
-                self.notify('Error encountered', self.last_command.output)
+                self.notify('Error encountered', \
+                        'Error running the following command:\n\t%s\n\nCommand output:\n\t%s' % \
+                        (command, self.last_command.output))
             if exit_on_error:
                 sys.exit(-1)
         return self.last_command.status

Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/startup.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/startup.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/startup.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/pyami/startup.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/pyami/startup.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
    (empty)

Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/__init__.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/__init__.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/__init__.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/__init__.py Sun Jun  5 08:34:02 2011
@@ -0,0 +1,813 @@
+# 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.
+#
+
+import xml.sax
+import base64
+import time
+import boto
+import boto.utils
+import urllib
+from boto.connection import AWSQueryConnection
+from boto import handler
+from boto.resultset import ResultSet
+from boto.rds.dbinstance import DBInstance
+from boto.rds.dbsecuritygroup import DBSecurityGroup
+from boto.rds.parametergroup import ParameterGroup
+from boto.rds.dbsnapshot import DBSnapshot
+from boto.rds.event import Event
+
+#boto.set_stream_logger('rds')
+
+class RDSConnection(AWSQueryConnection):
+
+    DefaultHost = 'rds.amazonaws.com'
+    APIVersion = '2009-10-16'
+    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=DefaultHost, debug=0,
+                 https_connection_factory=None, path='/'):
+        AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key,
+                                    is_secure, port, proxy, proxy_port, proxy_user,
+                                    proxy_pass, self.DefaultHost, debug,
+                                    https_connection_factory, path)
+
+    # DB Instance methods
+        
+    def get_all_dbinstances(self, instance_id=None, max_records=None,
+                            marker=None):
+        """
+        Retrieve all the DBInstances in your account.
+        
+        :type instance_id: str
+        :param instance_id: DB Instance identifier.  If supplied, only information
+                            this instance will be returned.  Otherwise, info
+                            about all DB Instances will be returned.
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: list
+        :return: A list of :class:`boto.rds.dbinstance.DBInstance`
+        """
+        params = {}
+        if instance_id:
+            params['DBInstanceIdentifier'] = instance_id
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        return self.get_list('DescribeDBInstances', params, [('DBInstance', DBInstance)])
+
+    def create_dbinstance(self, id, allocated_storage, instance_class,
+                          master_username, master_password, port=3306,
+                          engine='MySQL5.1', db_name=None, param_group=None,
+                          security_groups=None, availability_zone=None,
+                          preferred_maintenance_window=None,
+                          backup_retention_period=None,
+                          preferred_backup_window=None):
+        """
+        Create a new DBInstance.
+
+        :type id: str
+        :param id: Unique identifier for the new instance.
+                   Must contain 1-63 alphanumeric characters.
+                   First character must be a letter.
+                   May not end with a hyphen or contain two consecutive hyphens
+
+        :type allocated_storage: int
+        :param allocated_storage: Initially allocated storage size, in GBs.
+                                  Valid values are [5-1024]
+
+        :type instance_class: str
+        :param instance_class: The compute and memory capacity of the DBInstance.
+                               Valid values are:
+                               db.m1.small | db.m1.large | db.m1.xlarge |
+                               db.m2.2xlarge | db.m2.4xlarge
+
+        :type engine: str
+.       :param engine: Name of database engine.  Must be MySQL5.1 for now.
+
+        :type master_username: str
+        :param master_username: Name of master user for the DBInstance.
+                                Must be 1-15 alphanumeric characters, first must be
+                                a letter.
+
+        :type master_password: str
+        :param master_password: Password of master user for the DBInstance.
+                                Must be 4-16 alphanumeric characters.
+
+        :type port: int
+        :param port: Port number on which database accepts connections.
+                     Valid values [1115-65535].  Defaults to 3306.
+
+        :type db_name: str
+        :param db_name: Name of a database to create when the DBInstance
+                        is created.  Default is to create no databases.
+
+        :type param_group: str
+        :param param_group: Name of DBParameterGroup to associate with
+                            this DBInstance.  If no groups are specified
+                            no parameter groups will be used.
+                        
+        :type security_groups: list of str or list of DBSecurityGroup objects
+        :param security_groups: List of names of DBSecurityGroup to authorize on
+                                this DBInstance.
+                        
+        :type availability_zone: str
+        :param availability_zone: Name of the availability zone to place
+                                  DBInstance into.
+
+        :type preferred_maintenance_window: str
+        :param preferred_maintenance_window: The weekly time range (in UTC) during
+                                             which maintenance can occur.
+                                             Default is Sun:05:00-Sun:09:00
+
+        :type backup_retention_period: int
+        :param backup_retention_period: The number of days for which automated
+                                        backups are retained.  Setting this to
+                                        zero disables automated backups.
+
+        :type preferred_backup_window: str
+        :param preferred_backup_window: The daily time range during which
+                                        automated backups are created (if
+                                        enabled).  Must be in h24:mi-hh24:mi
+                                        format (UTC).
+                                        
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The new db instance.
+        """
+        params = {'DBInstanceIdentifier' : id,
+                  'AllocatedStorage' : allocated_storage,
+                  'DBInstanceClass' : instance_class,
+                  'Engine' : engine,
+                  'MasterUsername' : master_username,
+                  'MasterUserPassword' : master_password}
+        if port:
+            params['Port'] = port
+        if db_name:
+            params['DBName'] = db_name
+        if param_group:
+            params['DBParameterGroup'] = param_group
+        if security_groups:
+            l = []
+            for group in security_groups:
+                if isinstance(group, DBSecurityGroup):
+                    l.append(group.name)
+                else:
+                    l.append(group)
+            self.build_list_params(params, l, 'DBSecurityGroups.member')
+        if availability_zone:
+            params['AvailabilityZone'] = availability_zone
+        if preferred_maintenance_window:
+            params['PreferredMaintenanceWindow'] = preferred_maintenance_window
+        if backup_retention_period:
+            params['BackupRetentionPeriod'] = backup_retention_period
+        if preferred_backup_window:
+            params['PreferredBackupWindow'] = preferred_backup_window
+            
+        return self.get_object('CreateDBInstance', params, DBInstance)
+        
+    def modify_dbinstance(self, id, param_group=None, security_groups=None,
+                          preferred_maintenance_window=None,
+                          master_password=None, allocated_storage=None,
+                          backup_retention_period=None,
+                          preferred_backup_window=None,
+                          apply_immediately=False):
+        """
+        Modify an existing DBInstance.
+
+        :type id: str
+        :param id: Unique identifier for the new instance.
+
+        :type security_groups: list of str or list of DBSecurityGroup objects
+        :param security_groups: List of names of DBSecurityGroup to authorize on
+                                this DBInstance.
+                        
+        :type preferred_maintenance_window: str
+        :param preferred_maintenance_window: The weekly time range (in UTC) during
+                                             which maintenance can occur.
+                                             Default is Sun:05:00-Sun:09:00
+                                             
+        :type master_password: str
+        :param master_password: Password of master user for the DBInstance.
+                                Must be 4-15 alphanumeric characters.
+
+        :type allocated_storage: int
+        :param allocated_storage: The new allocated storage size, in GBs.
+                                  Valid values are [5-1024]
+                                  
+        :type instance_class: str
+        :param instance_class: The compute and memory capacity of the DBInstance.
+                               Changes will be applied at next maintenance
+                               window unless apply_immediately is True.
+                               Valid values are:
+                               db.m1.small | db.m1.large | db.m1.xlarge |
+                               db.m2.2xlarge | db.m2.4xlarge
+
+        :type apply_immediately: bool
+        :param apply_immediately: If true, the modifications will be applied
+                                  as soon as possible rather than waiting for
+                                  the next preferred maintenance window.
+
+        :type backup_retention_period: int
+        :param backup_retention_period: The number of days for which automated
+                                        backups are retained.  Setting this to
+                                        zero disables automated backups.
+
+        :type preferred_backup_window: str
+        :param preferred_backup_window: The daily time range during which
+                                        automated backups are created (if
+                                        enabled).  Must be in h24:mi-hh24:mi
+                                        format (UTC).
+                                        
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The modified db instance.
+        """
+        params = {'DBInstanceIdentifier' : id}
+        if param_group:
+            params['DBParameterGroupName'] = param_group
+        if security_groups:
+            l = []
+            for group in security_groups:
+                if isinstance(group, DBSecurityGroup):
+                    l.append(group.name)
+                else:
+                    l.append(group)
+            self.build_list_params(params, l, 'DBSecurityGroups.member')
+        if preferred_maintenance_window:
+            params['PreferredMaintenanceWindow'] = preferred_maintenance_window
+        if master_password:
+            params['MasterUserPassword'] = master_password
+        if allocated_storage:
+            params['AllocatedStorage'] = allocated_storage
+        if backup_retention_period:
+            params['BackupRetentionPeriod'] = backup_retention_period
+        if preferred_backup_window:
+            params['PreferredBackupWindow'] = preferred_backup_window
+        if apply_immediately:
+            params['ApplyImmediately'] = 'true'
+            
+        return self.get_object('ModifyDBInstance', params, DBInstance)
+        
+    def delete_dbinstance(self, id, skip_final_snapshot=False,
+                          final_snapshot_id=''):
+        """
+        Delete an existing DBInstance.
+
+        :type id: str
+        :param id: Unique identifier for the new instance.
+
+        :type skip_final_snapshot: bool
+        :param skip_final_snapshot: This parameter determines whether a final
+                                    db snapshot is created before the instance
+                                    is deleted.  If True, no snapshot is created.
+                                    If False, a snapshot is created before
+                                    deleting the instance.
+
+        :type final_snapshot_id: str
+        :param final_snapshot_id: If a final snapshot is requested, this
+                                  is the identifier used for that snapshot.
+
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The deleted db instance.
+        """
+        params = {'DBInstanceIdentifier' : id}
+        if skip_final_snapshot:
+            params['SkipFinalSnapshot'] = 'true'
+        else:
+            params['SkipFinalSnapshot'] = 'false'
+            params['FinalDBSnapshotIdentifier'] = final_snapshot_id
+        return self.get_object('DeleteDBInstance', params, DBInstance)
+        
+    # DBParameterGroup methods
+        
+    def get_all_dbparameter_groups(self, groupname=None, max_records=None,
+                                  marker=None):
+        """
+        Get all parameter groups associated with your account in a region.
+        
+        :type groupname: str
+        :param groupname: The name of the DBParameter group to retrieve.
+                          If not provided, all DBParameter groups will be returned.
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: list
+        :return: A list of :class:`boto.ec2.parametergroup.ParameterGroup`
+        """
+        params = {}
+        if groupname:
+            params['DBParameterGroupName'] = groupname
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        return self.get_list('DescribeDBParameterGroups', params,
+                             [('DBParameterGroup', ParameterGroup)])
+
+    def get_all_dbparameters(self, groupname, source=None,
+                             max_records=None, marker=None):
+        """
+        Get all parameters associated with a ParameterGroup
+        
+        :type groupname: str
+        :param groupname: The name of the DBParameter group to retrieve.
+
+        :type source: str
+        :param source: Specifies which parameters to return.
+                       If not specified, all parameters will be returned.
+                       Valid values are: user|system|engine-default
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: :class:`boto.ec2.parametergroup.ParameterGroup`
+        :return: The ParameterGroup
+        """
+        params = {'DBParameterGroupName' : groupname}
+        if source:
+            params['Source'] = source
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        pg = self.get_object('DescribeDBParameters', params, ParameterGroup)
+        pg.name = groupname
+        return pg
+
+    def create_parameter_group(self, name, engine='MySQL5.1', description=''):
+        """
+        Create a new dbparameter group for your account.
+        
+        :type name: string
+        :param name: The name of the new dbparameter group
+        
+        :type engine: str
+        :param engine: Name of database engine.  Must be MySQL5.1 for now.
+
+        :type description: string
+        :param description: The description of the new security group
+        
+        :rtype: :class:`boto.rds.dbsecuritygroup.DBSecurityGroup`
+        :return: The newly created DBSecurityGroup
+        """
+        params = {'DBParameterGroupName': name,
+                  'Engine': engine,
+                  'Description' : description}
+        return self.get_object('CreateDBParameterGroup', params, ParameterGroup)
+
+    def modify_parameter_group(self, name, parameters=None):
+        """
+        Modify a parameter group for your account.
+        
+        :type name: string
+        :param name: The name of the new parameter group
+        
+        :type parameters: list of :class:`boto.rds.parametergroup.Parameter`
+        :param parameters: The new parameters
+
+        :rtype: :class:`boto.rds.parametergroup.ParameterGroup`
+        :return: The newly created ParameterGroup
+        """
+        params = {'DBParameterGroupName': name}
+        for i in range(0, len(parameters)):
+            parameter = parameters[i]
+            parameter.merge(params, i+1)
+        return self.get_list('ModifyDBParameterGroup', params, ParameterGroup)
+
+    def reset_parameter_group(self, name, reset_all_params=False, parameters=None):
+        """
+        Resets some or all of the parameters of a ParameterGroup to the
+        default value
+        
+        :type key_name: string
+        :param key_name: The name of the ParameterGroup to reset
+
+        :type parameters: list of :class:`boto.rds.parametergroup.Parameter`
+        :param parameters: The parameters to reset.  If not supplied, all parameters
+                           will be reset.
+        """
+        params = {'DBParameterGroupName':name}
+        if reset_all_params:
+            params['ResetAllParameters'] = 'true'
+        else:
+            params['ResetAllParameters'] = 'false'
+            for i in range(0, len(parameters)):
+                parameter = parameters[i]
+                parameter.merge(params, i+1)
+        return self.get_status('ResetDBParameterGroup', params)
+
+    def delete_parameter_group(self, name):
+        """
+        Delete a DBSecurityGroup from your account.
+        
+        :type key_name: string
+        :param key_name: The name of the DBSecurityGroup to delete
+        """
+        params = {'DBParameterGroupName':name}
+        return self.get_status('DeleteDBParameterGroup', params)
+
+    # DBSecurityGroup methods
+        
+    def get_all_dbsecurity_groups(self, groupname=None, max_records=None,
+                                  marker=None):
+        """
+        Get all security groups associated with your account in a region.
+        
+        :type groupnames: list
+        :param groupnames: A list of the names of security groups to retrieve.
+                           If not provided, all security groups will be returned.
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: list
+        :return: A list of :class:`boto.rds.dbsecuritygroup.DBSecurityGroup`
+        """
+        params = {}
+        if groupname:
+            params['DBSecurityGroupName'] = groupname
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        return self.get_list('DescribeDBSecurityGroups', params,
+                             [('DBSecurityGroup', DBSecurityGroup)])
+
+    def create_dbsecurity_group(self, name, description=None):
+        """
+        Create a new security group for your account.
+        This will create the security group within the region you
+        are currently connected to.
+        
+        :type name: string
+        :param name: The name of the new security group
+        
+        :type description: string
+        :param description: The description of the new security group
+        
+        :rtype: :class:`boto.rds.dbsecuritygroup.DBSecurityGroup`
+        :return: The newly created DBSecurityGroup
+        """
+        params = {'DBSecurityGroupName':name}
+        if description:
+            params['DBSecurityGroupDescription'] = description
+        group = self.get_object('CreateDBSecurityGroup', params, DBSecurityGroup)
+        group.name = name
+        group.description = description
+        return group
+
+    def delete_dbsecurity_group(self, name):
+        """
+        Delete a DBSecurityGroup from your account.
+        
+        :type key_name: string
+        :param key_name: The name of the DBSecurityGroup to delete
+        """
+        params = {'DBSecurityGroupName':name}
+        return self.get_status('DeleteDBSecurityGroup', params)
+
+    def authorize_dbsecurity_group(self, group_name, cidr_ip=None,
+                                   ec2_security_group_name=None,
+                                   ec2_security_group_owner_id=None):
+        """
+        Add a new rule to an existing security group.
+        You need to pass in either src_security_group_name and
+        src_security_group_owner_id OR a CIDR block but not both.
+        
+        :type group_name: string
+        :param group_name: The name of the security group you are adding
+                           the rule to.
+                           
+        :type ec2_security_group_name: string
+        :param ec2_security_group_name: The name of the EC2 security group you are 
+                                        granting access to.
+                                        
+        :type ec2_security_group_owner_id: string
+        :param ec2_security_group_owner_id: The ID of the owner of the EC2 security
+                                            group you are granting access to.
+                                            
+        :type cidr_ip: string
+        :param cidr_ip: The CIDR block you are providing access to.
+                        See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
+
+        :rtype: bool
+        :return: True if successful.
+        """
+        params = {'DBSecurityGroupName':group_name}
+        if ec2_security_group_name:
+            params['EC2SecurityGroupName'] = ec2_security_group_name
+        if ec2_security_group_owner_id:
+            params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id
+        if cidr_ip:
+            params['CIDRIP'] = urllib.quote(cidr_ip)
+        return self.get_object('AuthorizeDBSecurityGroupIngress', params, DBSecurityGroup)
+
+    def revoke_security_group(self, group_name, ec2_security_group_name=None,
+                              ec2_security_group_owner_id=None, cidr_ip=None):
+        """
+        Remove an existing rule from an existing security group.
+        You need to pass in either ec2_security_group_name and
+        ec2_security_group_owner_id OR a CIDR block.
+        
+        :type group_name: string
+        :param group_name: The name of the security group you are removing
+                           the rule from.
+                           
+        :type ec2_security_group_name: string
+        :param ec2_security_group_name: The name of the EC2 security group you are 
+                                        granting access to.
+                                        
+        :type ec2_security_group_owner_id: string
+        :param ec2_security_group_owner_id: The ID of the owner of the EC2 security
+                                            group you are granting access to.
+                                            
+        :type cidr_ip: string
+        :param cidr_ip: The CIDR block you are providing access to.
+                        See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
+
+        :rtype: bool
+        :return: True if successful.
+        """
+        params = {'DBSecurityGroupName':group_name}
+        if ec2_security_group_name:
+            params['EC2SecurityGroupName'] = ec2_security_group_name
+        if ec2_security_group_owner_id:
+            params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id
+        if cidr_ip:
+            params['CIDRIP'] = cidr_ip
+        return self.get_object('RevokeDBSecurityGroupIngress', params, DBSecurityGroup)
+
+    # DBSnapshot methods
+        
+    def get_all_dbsnapshots(self, snapshot_id=None, instance_id=None,
+                            max_records=None, marker=None):
+        """
+        Get information about DB Snapshots.  
+        
+        :type snapshot_id: str
+        :param snapshot_id: The unique identifier of an RDS snapshot.
+                            If not provided, all RDS snapshots will be returned.
+        
+        :type instance_id: str
+        :param instance_id: The identifier of a DBInstance.  If provided,
+                            only the DBSnapshots related to that instance will
+                            be returned.
+                            If not provided, all RDS snapshots will be returned.
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: list
+        :return: A list of :class:`boto.rds.dbsnapshot.DBSnapshot`
+        """
+        params = {}
+        if snapshot_id:
+            params['DBSnapshotIdentifier'] = snapshot_id
+        if instance_id:
+            params['DBInstanceIdentifier'] = instance_id
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        return self.get_list('DescribeDBSnapshots', params,
+                             [('DBSnapshots', DBSnapshot)])
+
+    def create_dbsnapshot(self, snapshot_id, dbinstance_id):
+        """
+        Create a new DB snapshot.
+        
+        :type snapshot_id: string
+        :param snapshot_id: The identifier for the DBSnapshot
+        
+        :type dbinstance_id: string
+        :param dbinstance_id: The source identifier for the RDS instance from
+                              which the snapshot is created.
+        
+        :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot`
+        :return: The newly created DBSnapshot
+        """
+        params = {'DBSnapshotIdentifier' : snapshot_id,
+                  'DBInstanceIdentifier' : dbinstance_id}
+        return self.get_object('CreateDBSnapshot', params, DBSnapshot)
+
+    def delete_dbsnapshot(self, identifier):
+        """
+        Delete a DBSnapshot
+        
+        :type identifier: string
+        :param identifier: The identifier of the DBSnapshot to delete
+        """
+        params = {'DBSnapshotIdentifier' : identifier}
+        return self.get_object('DeleteDBSnapshot', params, DBSnapshot)
+
+    def restore_dbinstance_from_dbsnapshot(self, identifier, instance_id,
+                                           instance_class, port=None,
+                                           availability_zone=None):
+        
+        """
+        Create a new DBInstance from a DB snapshot.
+        
+        :type identifier: string
+        :param identifier: The identifier for the DBSnapshot
+        
+        :type instance_id: string
+        :param instance_id: The source identifier for the RDS instance from
+                              which the snapshot is created.
+        
+        :type instance_class: str
+        :param instance_class: The compute and memory capacity of the DBInstance.
+                               Valid values are:
+                               db.m1.small | db.m1.large | db.m1.xlarge |
+                               db.m2.2xlarge | db.m2.4xlarge
+
+        :type port: int
+        :param port: Port number on which database accepts connections.
+                     Valid values [1115-65535].  Defaults to 3306.
+
+        :type availability_zone: str
+        :param availability_zone: Name of the availability zone to place
+                                  DBInstance into.
+
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The newly created DBInstance
+        """
+        params = {'DBSnapshotIdentifier' : identifier,
+                  'DBInstanceIdentifier' : instance_id,
+                  'DBInstanceClass' : instance_class}
+        if port:
+            params['Port'] = port
+        if availability_zone:
+            params['AvailabilityZone'] = availability_zone
+        return self.get_object('RestoreDBInstanceFromDBSnapshot',
+                               params, DBInstance)
+
+    def restore_dbinstance_from_point_in_time(self, source_instance_id,
+                                              target_instance_id,
+                                              use_latest=False,
+                                              restore_time=None,
+                                              dbinstance_class=None,
+                                              port=None,
+                                              availability_zone=None):
+        
+        """
+        Create a new DBInstance from a point in time.
+        
+        :type source_instance_id: string
+        :param source_instance_id: The identifier for the source DBInstance.
+        
+        :type target_instance_id: string
+        :param target_instance_id: The identifier of the new DBInstance.
+
+        :type use_latest: bool
+        :param use_latest: If True, the latest snapshot availabile will
+                           be used.
+
+        :type restore_time: datetime
+        :param restore_time: The date and time to restore from.  Only
+                             used if use_latest is False.
+        
+        :type instance_class: str
+        :param instance_class: The compute and memory capacity of the DBInstance.
+                               Valid values are:
+                               db.m1.small | db.m1.large | db.m1.xlarge |
+                               db.m2.2xlarge | db.m2.4xlarge
+
+        :type port: int
+        :param port: Port number on which database accepts connections.
+                     Valid values [1115-65535].  Defaults to 3306.
+
+        :type availability_zone: str
+        :param availability_zone: Name of the availability zone to place
+                                  DBInstance into.
+
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The newly created DBInstance
+        """
+        params = {'SourceDBInstanceIdentifier' : source_instance_id,
+                  'TargetDBInstanceIdentifier' : target_instance_id}
+        if use_latest:
+            params['UseLatestRestorableTime'] = 'true'
+        elif restore_time:
+            params['RestoreTime'] = restore_time.isoformat()
+        if instance_class:
+            params['DBInstanceClass'] = instance_class
+        if port:
+            params['Port'] = port
+        if availability_zone:
+            params['AvailabilityZone'] = availability_zone
+        return self.get_object('RestoreDBInstanceToPointInTime',
+                               params, DBInstance)
+
+    # Events
+
+    def get_all_events(self, source_identifier=None, source_type=None,
+                       start_time=None, end_time=None,
+                       max_records=None, marker=None):
+        """
+        Get information about events related to your DBInstances,
+        DBSecurityGroups and DBParameterGroups.
+        
+        :type source_identifier: str
+        :param source_identifier: If supplied, the events returned will be
+                                  limited to those that apply to the identified
+                                  source.  The value of this parameter depends
+                                  on the value of source_type.  If neither
+                                  parameter is specified, all events in the time
+                                  span will be returned.
+
+        :type source_type: str
+        :param source_type: Specifies how the source_identifier should
+                            be interpreted.  Valid values are:
+                            b-instance | db-security-group |
+                            db-parameter-group | db-snapshot
+
+        :type start_time: datetime
+        :param start_time: The beginning of the time interval for events.
+                           If not supplied, all available events will
+                           be returned.
+        
+        :type end_time: datetime
+        :param end_time: The ending of the time interval for events.
+                         If not supplied, all available events will
+                         be returned.
+        
+        :type max_records: int
+        :param max_records: The maximum number of records to be returned.
+                            If more results are available, a MoreToken will
+                            be returned in the response that can be used to
+                            retrieve additional records.  Default is 100.
+        
+        :type marker: str
+        :param marker: The marker provided by a previous request. 
+        
+        :rtype: list
+        :return: A list of class:`boto.rds.event.Event`
+        """
+        params = {}
+        if source_identifier and source_type:
+            params['SourceIdentifier'] = source_identifier
+            params['SourceType'] = source_type
+        if start_time:
+            params['StartTime'] = start_time.isoformat()
+        if end_time:
+            params['EndTime'] = end_time.isoformat()
+        if max_records:
+            params['MaxRecords'] = max_records
+        if marker:
+            params['Marker'] = marker
+        return self.get_list('DescribeEvents', params, [('Event', Event)])
+
+    

Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbinstance.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbinstance.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbinstance.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbinstance.py Sun Jun  5 08:34:02 2011
@@ -0,0 +1,136 @@
+# 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.
+
+from boto.rds.dbsecuritygroup import DBSecurityGroup
+from boto.rds.parametergroup import ParameterGroup
+
+class DBInstance(object):
+    """
+    Represents a RDS  DBInstance
+    """
+    
+    def __init__(self, connection=None, id=None):
+        self.connection = connection
+        self.id = id
+        self.create_time = None
+        self.engine = None
+        self.status = None
+        self.allocated_storage = None
+        self.endpoint = None
+        self.instance_class = None
+        self.master_username = None
+        self.parameter_group = None
+        self.security_group = None
+        self.availability_zone = None
+        self.backup_retention_period = None
+        self.preferred_backup_window = None
+        self.preferred_maintenance_window = None
+        self.latest_restorable_time = None
+        self._in_endpoint = False
+        self._port = None
+        self._address = None
+
+    def __repr__(self):
+        return 'DBInstance:%s' % self.id
+
+    def startElement(self, name, attrs, connection):
+        if name == 'Endpoint':
+            self._in_endpoint = True
+        elif name == 'DBParameterGroup':
+            self.parameter_group = ParameterGroup(self.connection)
+            return self.parameter_group
+        elif name == 'DBSecurityGroup':
+            self.security_group = DBSecurityGroup(self.connection)
+            return self.security_group
+        return None
+
+    def endElement(self, name, value, connection):
+        if name == 'DBInstanceIdentifier':
+            self.id = value
+        elif name == 'DBInstanceStatus':
+            self.status = value
+        elif name == 'InstanceCreateTime':
+            self.create_time = value
+        elif name == 'Engine':
+            self.engine = value
+        elif name == 'DBInstanceStatus':
+            self.status = value
+        elif name == 'AllocatedStorage':
+            self.allocated_storage = int(value)
+        elif name == 'DBInstanceClass':
+            self.instance_class = value
+        elif name == 'MasterUsername':
+            self.master_username = value
+        elif name == 'Port':
+            if self._in_endpoint:
+                self._port = int(value)
+        elif name == 'Address':
+            if self._in_endpoint:
+                self._address = value
+        elif name == 'Endpoint':
+            self.endpoint = (self._address, self._port)
+            self._in_endpoint = False
+        elif name == 'AvailabilityZone':
+            self.availability_zone = value
+        elif name == 'BackupRetentionPeriod':
+            self.backup_retention_period = value
+        elif name == 'LatestRestorableTime':
+            self.latest_restorable_time = value
+        elif name == 'PreferredMaintenanceWindow':
+            self.preferred_maintenance_window = value
+        elif name == 'PreferredBackupWindow':
+            self.preferred_backup_window = value
+        else:
+            setattr(self, name, value)
+
+    def snapshot(self, snapshot_id):
+        """
+        Create a new DB snapshot of this DBInstance.
+        
+        :type identifier: string
+        :param identifier: The identifier for the DBSnapshot
+        
+        :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot`
+        :return: The newly created DBSnapshot
+        """
+        return self.connection.create_dbsnapshot(snapshot_id, self.id)
+
+    def stop(self, skip_final_snapshot, final_snapshot_id):
+        """
+        Delete this DBInstance.
+
+        :type skip_final_snapshot: bool
+        :param skip_final_snapshot: This parameter determines whether a final
+                                    db snapshot is created before the instance
+                                    is deleted.  If True, no snapshot is created.
+                                    If False, a snapshot is created before
+                                    deleting the instance.
+
+        :type final_snapshot_id: str
+        :param final_snapshot_id: If a final snapshot is requested, this
+                                  is the identifier used for that snapshot.
+
+        :rtype: :class:`boto.rds.dbinstance.DBInstance`
+        :return: The deleted db instance.
+        """
+        return self.connection.delete_dbinstance(self.id,
+                                                 skip_final_snapshot,
+                                                 final_snapshot_id)

Added: incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbsecuritygroup.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbsecuritygroup.py?rev=1132067&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbsecuritygroup.py (added)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/rds/dbsecuritygroup.py Sun Jun  5 08:34:02 2011
@@ -0,0 +1,159 @@
+# 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.
+
+"""
+Represents an DBSecurityGroup
+"""
+from boto.ec2.securitygroup import SecurityGroup
+
+class DBSecurityGroup(object):
+    
+    def __init__(self, connection=None, owner_id=None,
+                 name=None, description=None):
+        self.connection = connection
+        self.owner_id = owner_id
+        self.name = name
+        self.description = description
+        self.ec2_groups = []
+        self.ip_ranges = []
+
+    def __repr__(self):
+        return 'DBSecurityGroup:%s' % self.name
+
+    def startElement(self, name, attrs, connection):
+        if name == 'IPRange':
+            cidr = IPRange(self)
+            self.ip_ranges.append(cidr)
+            return cidr
+        elif name == 'EC2SecurityGroup':
+            ec2_grp = EC2SecurityGroup(self)
+            self.ec2_groups.append(ec2_grp)
+            return ec2_grp
+        else:
+            return None
+
+    def endElement(self, name, value, connection):
+        if name == 'OwnerId':
+            self.owner_id = value
+        elif name == 'DBSecurityGroupName':
+            self.name = value
+        elif name == 'DBSecurityGroupDescription':
+            self.description = value
+        elif name == 'IPRanges':
+            pass
+        else:
+            setattr(self, name, value)
+
+    def delete(self):
+        return self.connection.delete_dbsecurity_group(self.name)
+
+    def authorize(self, cidr_ip=None, ec2_group=None):
+        """
+        Add a new rule to this DBSecurity group.
+        You need to pass in either a CIDR block to authorize or
+        and EC2 SecurityGroup.
+        
+        @type cidr_ip: string
+        @param cidr_ip: A valid CIDR IP range to authorize
+
+        @type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup>`b
+                         
+        @rtype: bool
+        @return: True if successful.
+        """
+        if isinstance(ec2_group, SecurityGroup):
+            group_name = ec2_group.name
+            group_owner_id = ec2_group.owner_id
+        else:
+            group_name = None
+            group_owner_id = None
+        return self.connection.authorize_dbsecurity_group(self.name,
+                                                          cidr_ip,
+                                                          group_name,
+                                                          group_owner_id)
+
+    def revoke(self, cidr_ip=None, ec2_group=None):
+        """
+        Revoke access to a CIDR range or EC2 SecurityGroup
+        You need to pass in either a CIDR block to authorize or
+        and EC2 SecurityGroup.
+        
+        @type cidr_ip: string
+        @param cidr_ip: A valid CIDR IP range to authorize
+
+        @type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup>`b
+                         
+        @rtype: bool
+        @return: True if successful.
+        """
+        if isinstance(ec2_group, SecurityGroup):
+            group_name = ec2_group.name
+            group_owner_id = ec2_group.owner_id
+        else:
+            group_name = None
+            group_owner_id = None
+        return self.connection.revoke_dbsecurity_group(self.name,
+                                                       cidr_ip,
+                                                       group_name,
+                                                       group_owner_id)
+
+class IPRange(object):
+
+    def __init__(self, parent=None):
+        self.parent = parent
+        self.cidr_ip = None
+        self.status = None
+
+    def __repr__(self):
+        return 'IPRange:%s' % self.cidr_ip
+
+    def startElement(self, name, attrs, connection):
+        pass
+
+    def endElement(self, name, value, connection):
+        if name == 'CIDRIP':
+            self.cidr_ip = value
+        elif name == 'Status':
+            self.status = value
+        else:
+            setattr(self, name, value)
+
+class EC2SecurityGroup(object):
+
+    def __init__(self, parent=None):
+        self.parent = parent
+        self.name = None
+        self.owner_id = None
+
+    def __repr__(self):
+        return 'EC2SecurityGroup:%s' % self.name
+
+    def startElement(self, name, attrs, connection):
+        pass
+
+    def endElement(self, name, value, connection):
+        if name == 'EC2SecurityGroupName':
+            self.name = value
+        elif name == 'EC2SecurityGroupOwnerId':
+            self.owner_id = value
+        else:
+            setattr(self, name, value)
+



Mime
View raw message