code: private void setAcl(String bucketName, String key, String versionId, CannedAccessControlList cannedAcl, boolean isRequesterPays,
              AmazonWebServiceRequest originalRequest) {
          if (originalRequest == null) originalRequest = new GenericBucketRequest(bucketName);
  
          Request<AmazonWebServiceRequest> request = createRequest(bucketName, key, originalRequest, HttpMethodName.PUT);
  
          if (bucketName != null && key != null) {
              request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutObjectAcl");
          } else if (bucketName != null) {
              request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutBucketAcl");
          }
  
          request.addParameter("acl", null);
          request.addHeader(Headers.S3_CANNED_ACL, cannedAcl.toString());
          if (versionId != null) request.addParameter("versionId", versionId);
          populateRequesterPaysHeader(request, isRequesterPays);
  
          invoke(request, voidResponseHandler, bucketName, key);
      }
docs: Sets the Canned ACL for the specified resource in S3. If only bucketName
  is specified, the canned ACL will be applied to the bucket, otherwise if
  bucketName and key are specified, the canned ACL will be applied to the
  object.
  
  @param bucketName
  The name of the bucket containing the specified key, or if no
  key is listed, the bucket whose ACL will be set.
  @param key
  The optional object key within the specified bucket whose ACL
  will be set. If not specified, the bucket ACL will be set.
  @param versionId
  The version ID of the object version whose ACL is being set.
  @param cannedAcl
  The canned ACL to apply to the resource.
  @param originalRequest
  The original, user facing request object.