Examples of Grant


Examples of org.jclouds.s3.domain.AccessControlList.Grant

   public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(S3AsyncClient.class, "enableBucketLogging", String.class, BucketLogging.class);
      GeneratedHttpRequest request = processor
               .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
                        .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));

      assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/bucket_logging.xml")),
               "text/xml", false);
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

            currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName);
         } else if ("Group".equals(currentGranteeType)) {
            currentGrantee = new GroupGrantee(URI.create(currentId));
         }
      } else if (qName.equals("Grant")) {
         targetGrants.add(new Grant(currentGrantee, currentPermission));
      } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) {
         currentId = currentOrNull(currentText);
      } else if (qName.equals("DisplayName")) {
         currentDisplayName = currentOrNull(currentText);
      } else if (qName.equals("Permission")) {
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

      try {
         assertNull(getApi().getBucketLogging(bucketName));

         setupAclForBucketLoggingTarget(targetBucket);
         final BucketLogging logging = new BucketLogging(targetBucket, "access_log-",
               ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(StubS3AsyncClient.TEST_ACL_EMAIL),
                     Permission.FULL_CONTROL)));

         getApi().enableBucketLogging(bucketName, logging);

         assertConsistencyAware(new Runnable() {
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

   public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(S3Client.class, "enableBucketLogging", String.class, BucketLogging.class);
      GeneratedHttpRequest request = processor
               .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
                        .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));

      assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/bucket_logging.xml")),
               "text/xml", false);
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

public class BindBucketLoggingToXmlPayloadTest  extends BaseHandlerTest {

   public void testApplyInputStream() throws IOException {
     
      BucketLogging bucketLogging = new BucketLogging("mylogs", "access_log-", ImmutableSet
               .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"),
                        Permission.FULL_CONTROL)));
    
      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream(
               "/bucket_logging.xml"));
     
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

      try {
         assertNull(getApi().getBucketLogging(bucketName));

         setupAclForBucketLoggingTarget(targetBucket);
         final BucketLogging logging = new BucketLogging(targetBucket, "access_log-",
               ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(TEST_ACL_EMAIL), FULL_CONTROL)));

         getApi().enableBucketLogging(bucketName, logging);

         assertConsistencyAware(new Runnable() {
            public void run() {
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

@Test(groups = "unit", testName = "BucketLoggingHandlerTest")
public class BucketLoggingHandlerTest extends BaseHandlerTest {
   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/bucket_logging.xml");

      BucketLogging expected = new BucketLogging("mylogs", "access_log-", ImmutableSet.<Grant> of(new Grant(
            new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)));
      BucketLoggingHandler handler = injector.getInstance(BucketLoggingHandler.class);
      BucketLogging result = factory.create(handler).parse(is);

      assertEquals(result.getTargetBucket(), expected.getTargetBucket());
View Full Code Here

Examples of org.jclouds.s3.domain.AccessControlList.Grant

            currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName);
         } else if ("Group".equals(currentGranteeType)) {
            currentGrantee = new GroupGrantee(URI.create(currentId));
         }
      } else if (qName.equals("Grant")) {
         targetGrants.add(new Grant(currentGrantee, currentPermission));
      } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) {
         currentId = currentOrNull(currentText);
      } else if (qName.equals("DisplayName")) {
         currentDisplayName = currentOrNull(currentText);
      } else if (qName.equals("Permission")) {
View Full Code Here

Examples of org.jets3t.service.impl.soap.axis._2006_03_01.Grant

        AccessControlList acl = new AccessControlList();
        acl.setOwner(convertOwner(policy.getOwner()));
       
        Grant[] grants = policy.getAccessControlList();
        for (int i = 0; i < grants.length; i++) {
            Grant grant = (Grant) grants[i];
            org.jets3t.service.acl.Permission permission =
                org.jets3t.service.acl.Permission.parsePermission(grant.getPermission().toString());           
           
            Grantee grantee = grant.getGrantee();
            if (grantee instanceof Group) {
                GroupGrantee jets3tGrantee = new GroupGrantee();
                jets3tGrantee.setIdentifier(((Group)grantee).getURI());               
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof CanonicalUser) {
View Full Code Here

Examples of org.jets3t.service.impl.soap.axis._2006_03_01.Grant

        Iterator grantIter = acl.getGrants().iterator();
        int index = 0;
        while (grantIter.hasNext()) {
            GrantAndPermission jets3tGaP = (GrantAndPermission) grantIter.next();
            GranteeInterface jets3tGrantee = jets3tGaP.getGrantee();
            Grant grant = new Grant();
           
            if (jets3tGrantee instanceof GroupGrantee) {
                GroupGrantee groupGrantee = (GroupGrantee) jets3tGrantee;
                Group group = new Group();
                group.setURI(groupGrantee.getIdentifier());
                grant.setGrantee(group);
            } else if (jets3tGrantee instanceof CanonicalGrantee) {
                CanonicalGrantee canonicalGrantee = (CanonicalGrantee) jets3tGrantee;
                CanonicalUser canonicalUser = new CanonicalUser();
                canonicalUser.setID(canonicalGrantee.getIdentifier());
                canonicalUser.setDisplayName(canonicalGrantee.getDisplayName());
                grant.setGrantee(canonicalUser);
            } else if (jets3tGrantee instanceof EmailAddressGrantee) {
                EmailAddressGrantee emailGrantee = (EmailAddressGrantee) jets3tGrantee;
                AmazonCustomerByEmail customerByEmail = new AmazonCustomerByEmail();
                customerByEmail.setEmailAddress(emailGrantee.getIdentifier());
                grant.setGrantee(customerByEmail);
            } else {
                throw new S3ServiceException("Unrecognised jets3t grantee type: "
                    + jets3tGrantee.getClass());
            }
            Permission permission = Permission.fromString(jets3tGaP.getPermission().toString());
            grant.setPermission(permission);
            grants[index++] = grant;
        }
        return grants;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.