Gets S3 Private ACL - Java AWS

Java examples for AWS:S3

Description

Gets S3 Private ACL

Demo Code

// Permission is hereby granted, free of charge, to any person obtaining a
//package com.java2s;

public class Main {
    /**//from w  w w .  j ava 2  s.  co  m
     * Gets Private ACL
     * 
     * @param selfId
     * @return
     */
    public static String getACLTemplatePrivate(String selfId) {
        StringBuffer acl = new StringBuffer();
        acl.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        acl.append("<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">");
        acl.append("<Owner>");
        acl.append("<ID>" + selfId + "</ID>");
        acl.append("</Owner>");
        acl.append("<AccessControlList>");
        acl.append("<Grant>");
        acl.append("<Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">");
        acl.append("<ID>" + selfId + "</ID>");
        acl.append("</Grantee>");
        acl.append("<Permission>FULL_CONTROL</Permission>");
        acl.append("</Grant>");
        acl.append("</AccessControlList>");
        acl.append("</AccessControlPolicy>");

        return acl.toString();
    }
}

Related Tutorials