Example #1
0
 def test_set_acl(self):
     owner = User(id='1234567890', display_name='test')
     acl = ACL()
     grant = Grant()
     grant.permission = "READ"
     grant.display_name = "test"
     grant.email_address = "*****@*****.**"
     acl.add_grant(grant)
     policy = Policy()
     policy.owner = owner
     policy.acl = acl
     bucket = conn.get_bucket(test_bucket)
     #ret = bucket.set_acl("public-read-write", test_key)
     ret = bucket.set_acl(policy, test_key)
     print(ret)
Example #2
0
 def test_set_acl(self):
     owner = User(id='1234567890', display_name='test')
     acl = ACL()
     grant = Grant()
     grant.permission = "READ"
     grant.display_name = "test"
     grant.email_address = "*****@*****.**"
     acl.add_grant(grant)
     policy = Policy()
     policy.owner = owner
     policy.acl = acl
     bucket = conn.get_bucket(test_bucket)
     #ret = bucket.set_acl("public-read-write", test_key)
     ret = bucket.set_acl(policy, test_key)
     print ret
Example #3
0
 def test_set_bucket_logging(self):
     bucket = conn.get_bucket(test_bucket)
     # logging is kind of xml string.
     from ks3.bucketlogging import BucketLogging
     target = test_bucket
     prefix = "test_bucket_access_log"
     grants = Grant()
     logging = BucketLogging(target, prefix, grants).to_xml()
     bucket.set_xml_logging(logging)
Example #4
0
 def test_set_bucket_acl(self):
     bucket = conn.get_bucket(test_bucket)
     p = Policy()
     acl = ACL()
     grant = Grant(id='test1',
                   display_name='test1',
                   type='CanonicalUser',
                   permission='READ')
     acl.add_grant(grant)
     p.owner = User(id='1234567890', display_name='test')
     p.acl = acl
     bucket.set_acl(acl_or_str=p, headers={'content-type': 'text/plain'})
Example #5
0
 def test_set_acl(self):
     owner = User(id='1234567890', display_name='test')
     acl = ACL()
     grant = Grant()
     grant.permission = "READ"
     grant.display_name = "test"
     grant.email_address = "*****@*****.**"
     grant.type = 'CanonicalUser'
     acl.add_grant(grant)
     policy = Policy()
     policy.owner = owner
     policy.acl = acl
     bucket = conn.get_bucket(test_bucket)
     # ret = bucket.set_acl("public-read-write", test_key)
     ret = bucket.set_xml_acl(policy.to_xml(),
                              test_key,
                              headers={'content-type': 'text/plain'})
     print(ret)
Example #6
0
 def startElement(self, name, attrs, connection):
     if name == 'Grant':
         self.grants.append(Grant())
         return self.grants[-1]
     else:
         return None