Repository: boto/botocore

Issue:
Update pagination/waiter configs for JSON models
This also runs the .extra.json files through a json formatter so that we have consistent diffs going forward as we pull in new changes.



Discussion:

Resolving patch:
diff --git a/botocore/parameters.py b/botocore/parameters.py
--- a/botocore/parameters.py
+++ b/botocore/parameters.py
@@ -518,9 +518,20 @@ def store_value_json(self, value, built_params, label):
     def to_xml(self, value, label=None):
         if not label:
             label = self.get_label()
-        xml = '<%s>' % label
+        xml = '<%s' % label
+        if hasattr(self, 'xmlnamespace'):
+            xml += ' xmlns:%s="%s" ' % (self.xmlnamespace['prefix'],
+                                       self.xmlnamespace['uri'])
+            # Now we need to look for members that have an
+            # xmlattribute attribute with a value of True.
+            # The value of these attributes belongs in the xmlattribute
+            # not in the body of the element.
+            for member in self.members:
+                if hasattr(member, 'xmlattribute'):
+                    xml += '%s="%s"' % (member.xmlname, value[member.name])
+        xml += '>'
         for member in self.members:
-            if member.name in value:
+            if member.name in value and not hasattr(member, 'xmlattribute'):
                 xml += member.to_xml(value[member.name], member.name)
         xml += '</%s>' % label
         return xml


Test patch:
diff --git a/tests/unit/test_s3_operations.py b/tests/unit/test_s3_operations.py
--- a/tests/unit/test_s3_operations.py
+++ b/tests/unit/test_s3_operations.py
@@ -25,10 +25,30 @@
 from tests import BaseEnvVar
 import botocore.session
 
-XMLBODY1 = """<CreateBucketConfiguration><LocationConstraint>sa-east-1</LocationConstraint></CreateBucketConfiguration>"""
-XMLBODY2 = """<LifecycleConfiguration><Rule><ID>archive-objects-glacier-immediately-upon-creation</ID><Prefix>glacierobjects/</Prefix><Status>Enabled</Status><Transition><Days>0</Days><StorageClass>GLACIER</StorageClass></Transition></Rule></LifecycleConfiguration>"""
-XMLBODY3 = """<Tagging><TagSet><Tag><Key>key1</Key><Value>value1</Value></Tag><Tag><Key>key2</Key><Value>value2</Value></Tag></TagSet></Tagging>"""
-XMLBODY4 = """<CORSConfiguration><CORSRule><AllowedHeader>*</AllowedHeader><AllowedMethod>PUT</AllowedMethod><AllowedMethod>POST</AllowedMethod><AllowedMethod>DELETE</AllowedMethod><AllowedOrigin>http://www.example1.com</AllowedOrigin><ExposeHeader>x-amz-server-side-encryption</ExposeHeader><MaxAgeSeconds>3000</MaxAgeSeconds></CORSRule><CORSRule><AllowedMethod>GET</AllowedMethod><AllowedOrigin>*</AllowedOrigin></CORSRule></CORSConfiguration>"""
+XMLBODY1 = ('<CreateBucketConfiguration><LocationConstraint>sa-east-1'
+            '</LocationConstraint></CreateBucketConfiguration>')
+XMLBODY2 = ('<LifecycleConfiguration><Rule><ID>archive-objects-glacier-'
+            'immediately-upon-creation</ID><Prefix>glacierobjects/</Prefix>'
+            '<Status>Enabled</Status><Transition><Days>0</Days>'
+            '<StorageClass>GLACIER</StorageClass></Transition></Rule>'
+            '</LifecycleConfiguration>')
+XMLBODY3 = ('<Tagging><TagSet><Tag><Key>key1</Key><Value>value1</Value></Tag>'
+            '<Tag><Key>key2</Key><Value>value2</Value></Tag></TagSet></Tagging>')
+XMLBODY4 = ('<CORSConfiguration><CORSRule><AllowedHeader>*</AllowedHeader>'
+            '<AllowedMethod>PUT</AllowedMethod><AllowedMethod>POST</AllowedMethod>'
+            '<AllowedMethod>DELETE</AllowedMethod>'
+            '<AllowedOrigin>http://www.example1.com</AllowedOrigin>'
+            '<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>'
+            '<MaxAgeSeconds>3000</MaxAgeSeconds></CORSRule><CORSRule>'
+            '<AllowedMethod>GET</AllowedMethod><AllowedOrigin>*</AllowedOrigin>'
+            '</CORSRule></CORSConfiguration>')
+XMLBODY5 = ('<BucketLoggingStatus><LoggingEnabled><TargetBucket>mybucketlogs'
+            '</TargetBucket><TargetGrants><Grant><Grantee '
+            'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
+            'xsi:type="AmazonCustomerByEmail"><EmailAddress>user@company.com'
+            '</EmailAddress></Grantee><Permission>READ</Permission></Grant>'
+            '</TargetGrants><TargetPrefix>mybucket-access_log-/</TargetPrefix>'
+            '</LoggingEnabled></BucketLoggingStatus>')
 
 POLICY = ('{"Version": "2008-10-17","Statement": [{"Sid": "AddPerm",'
           '"Effect": "Allow","Principal": {"AWS": "*"},'
@@ -145,6 +165,23 @@ def test_put_bucket_policy(self):
         self.assertEqual(params['payload'].getvalue(), POLICY)
         self.assertEqual(params['headers'], {})
 
+    def test_put_bucket_logging(self):
+        op = self.s3.get_operation('PutBucketLogging')
+        logging = {'LoggingEnabled':
+                       {'TargetBucket': 'mybucketlogs',
+                        'TargetPrefix': 'mybucket-access_log-/',
+                        'TargetGrants':
+                            [{'Grantee':
+                                  {'Type': 'AmazonCustomerByEmail',
+                                   'EmailAddress': 'user@company.com'},
+                              'Permission': 'READ'}]}}
+        params = op.build_parameters(bucket=self.bucket_name,
+                                     bucket_logging_status=logging)
+        uri_params = {'Bucket': self.bucket_name}
+        self.assertEqual(params['uri_params'], uri_params)
+        self.assertEqual(params['payload'].getvalue(), XMLBODY5)
+        self.assertEqual(params['headers'], {})
+
     def test_put_object(self):
         op = self.s3.get_operation('PutObject')
         file_path = os.path.join(os.path.dirname(__file__),