Package org.jclouds.s3.domain

Examples of org.jclouds.s3.domain.AccessControlList


   }

   private ListenableFuture<String> putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
View Full Code Here


   }

   private String putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
View Full Code Here

   }

   private ListenableFuture<String> putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
View Full Code Here

   }

   private String putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
View Full Code Here

      try {
         getApi().putBucketInRegion(Region.EU_WEST_1, bucketName + "eu", withBucketAcl(CannedAccessPolicy.PUBLIC_READ));
         assertConsistencyAware(new Runnable() {
            public void run() {
               try {
                  AccessControlList acl = getApi().getBucketACL(bucketName + "eu");
                  assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
               } catch (Exception e) {
                  Throwables.propagateIfPossible(e);
               }
            }
         });
View Full Code Here

         keyToAcl.put(bucketName + "/" + object.getMetadata().getKey(), options.getAcl());
      return blobStore.putBlob(bucketName, object2Blob.apply(object));
   }

   protected AccessControlList getACLforS3Item(String bucketAndObjectKey) {
      AccessControlList acl = null;
      Object aclObj = keyToAcl.get(bucketAndObjectKey);
      if (aclObj instanceof AccessControlList) {
         acl = (AccessControlList) aclObj;
      } else if (aclObj instanceof CannedAccessPolicy) {
         acl = AccessControlList.fromCannedAccessPolicy((CannedAccessPolicy) aclObj, DEFAULT_OWNER_ID);
View Full Code Here

         getApi().putObject(containerName, object, new PutObjectOptions().withAcl(CannedAccessPolicy.PUBLIC_READ));

         assertConsistencyAware(new Runnable() {
            public void run() {
               try {
                  AccessControlList acl = getApi().getObjectACL(containerName, publicReadObjectKey);

                  assertEquals(acl.getGrants().size(), 2);
                  assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1);
                  assertNotNull(acl.getOwner());
                  String ownerId = acl.getOwner().getId();
                  assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
                  assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
               } catch (Exception e) {
                  Throwables.propagateIfPossible(e);
               }
            }
         });
View Full Code Here

      mock = createMock(S3Client.class);
   }

   @Test
   void testMaxRetriesNotExceededReturnsValue() {
      AccessControlList acl = createMock(AccessControlList.class);

      int attempts = 5;
      BackoffOnNotFoundWhenGetBucketACL backoff = new BackoffOnNotFoundWhenGetBucketACL(mock);

      expect(mock.getBucketACL("foo")).andThrow(new ResourceNotFoundException()).times(attempts - 1);
View Full Code Here

   public void testPrivateAclIsDefaultForBucket() throws InterruptedException, ExecutionException, TimeoutException,
         IOException {
      String bucketName = getContainerName();
      try {
         AccessControlList acl = getApi().getBucketACL(bucketName);
         assertEquals(acl.getGrants().size(), 1);
         assertNotNull(acl.getOwner());
         String ownerId = acl.getOwner().getId();
         assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
      } finally {
         returnContainer(bucketName);
      }

   }
View Full Code Here

   public void testUpdateBucketACL() throws InterruptedException, ExecutionException, TimeoutException, IOException,
         Exception {
      String bucketName = getContainerName();
      try {
         // Confirm the bucket is private
         AccessControlList acl = getApi().getBucketACL(bucketName);
         String ownerId = acl.getOwner().getId();
         assertEquals(acl.getGrants().size(), 1);
         assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));

         addGrantsToACL(acl);
         assertEquals(acl.getGrants().size(), 4);
         assertTrue(getApi().putBucketACL(bucketName, acl));

         // Confirm that the updated ACL has stuck.
         acl = getApi().getBucketACL(bucketName);
         checkGrants(acl);
View Full Code Here

TOP

Related Classes of org.jclouds.s3.domain.AccessControlList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.