/// <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(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); }
/// <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); request.AddHeader("x-amz-acl", acl.ToString()); // ``us-east-1`` is not a valid location constraint according to amazon, so we skip it // Valid constraints are // [ us-west-1 | us-west-2 | EU or eu-west-1 | eu-central-1 | ap-southeast-1 | ap-northeast-1 | ap-southeast-2 | sa-east-1 ] if (this.region != "us-east-1") { CreateBucketConfiguration config = new CreateBucketConfiguration(this.region); request.AddBody(config); } var response = client.Execute(request); if (response.StatusCode == HttpStatusCode.OK) { return; } throw ParseError(response); }
/// <summary> /// Create a bucket with a given name and location. /// </summary> /// <param name="bucketName">Name of the new bucket</param> /// <param name="location">Name of the location</param> public void MakeBucket(string bucketName, string location) { var request = new RestRequest("/" + bucketName, Method.PUT); // ``us-east-1`` is not a valid location constraint according to amazon, so we skip it. if (location != "us-east-1") { CreateBucketConfiguration config = new CreateBucketConfiguration(location); request.AddBody(config); } var response = client.Execute(request); if (response.StatusCode == HttpStatusCode.OK) { return; } throw ParseError(response); }