예제 #1
0
        /// <summary>
        /// Write a new ACL for a given object (or bucket if key is null)
        /// </summary>
        /// <param name="bucket">The name of the bucket where the object lives or the
        /// name of the bucket to change the ACL if key is null.</param>
        /// <param name="key">The name of the key to use; can be null.</param>
        /// <param name="accessControList">Access Control Policy</param>
        public void putACL(string bucket, string key, Grant[] accessControList)
        {
            DateTime timestamp = AWSDateFormatter.GetCurrentTimeResolvedToMillis();

            if (key != null)
            {
                string signature = makeSignature("SetObjectAccessControlPolicy", timestamp);
                s3.SetObjectAccessControlPolicy(bucket, key, accessControList, awsAccessKeyId, timestamp, true, signature, null);
            }
            else
            {
                string signature = makeSignature("SetBucketAccessControlPolicy", timestamp);
                s3.SetBucketAccessControlPolicy(bucket, accessControList, awsAccessKeyId, timestamp, true, signature, null);
            }
        }