Ejemplo n.º 1
0
 /// <summary>
 /// Set a bucket's canned ACL
 /// </summary>
 /// <param name="bucket">Name of bucket to set canned ACL</param>
 /// <param name="acl">Canned ACL to set</param>
 public void SetBucketAcl(string bucket, Acl acl)
 {
     var request = new RestRequest(bucket + "?acl", Method.PUT);
     // TODO add acl header
     request.AddHeader("x-amz-acl", acl.ToString());
     var response = client.Execute(request);
     if (!HttpStatusCode.OK.Equals(response.StatusCode))
     {
         throw ParseError(response);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a bucket with a given name and canned ACL
        /// </summary>
        /// <param name="bucket">Name of the new bucket</param>
        /// <param name="acl">Canned ACL to set</param>
        public void MakeBucket(string bucket, Acl acl)
        {
            var request = new RestRequest("/" + bucket, Method.PUT);

            CreateBucketConfiguration config = new CreateBucketConfiguration()
            {
                LocationConstraint = this.region
            };

            request.AddHeader("x-amz-acl", acl.ToString());

            request.AddBody(config);

            var response = client.Execute(request);
            if (response.StatusCode == HttpStatusCode.OK)
            {
                return;
            }

            throw ParseError(response);
        }