最近更新时间:2021-09-18
以下代码用于获取桶的访问权限:
public void testGetBucketAcl() { try { AccessControlList acl = s3.getBucketAcl(bucketName); List grants = acl.getGrantsAsList(); for (Grant grant : grants) { System.out.format("%s\n",grant.getPermission().toString()); System.out.format("%s\n",s3.getBucketPolicy(bucketName).getPolicyText()); } } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } System.out.println("Done!"); }
public void testGetBucketAcl() { try { AccessControlList acl = s3.getBucketAcl(bucketName); List<Grant> grants = acl.getGrantsAsList(); for (Grant grant : grants) { System.out.format("%s\n",grant.getPermission().toString()); System.out.format("%s\n",s3.getBucketPolicy(bucketName).getPolicyText()); } } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } System.out.println("Done!"); } |