public static DeleteObjectHelper ( |
||
client | ||
bucketName | string | |
key | string | |
versionId | string | |
return | void |
public void TestPostCannedACLInner() { var key = string.Format(FileNameFormat, DateTime.Now.Ticks); // Authenticated Read S3TestUtils.PostObjectHelper(Client, BucketName, key, delegate(PostObjectRequest request) { request.CannedACL = S3CannedACL.AuthenticatedRead; }); var grants = S3TestUtils.GetACLHelper(Client, BucketName, key).AccessControlList.Grants; Utils.AssertTrue(GrantsContain(grants, AuthenticatedUsersUriSubstring, S3Permission.READ)); Utils.AssertTrue(GrantsDoNotContain(grants, AllUsersUriSubstring)); Utils.AssertTrue(GrantsDoNotContain(grants, LogDeliveryUriSubstring)); // No canned ACL equivalent to Private S3TestUtils.PostObjectHelper(Client, BucketName, key); grants = S3TestUtils.GetACLHelper(Client, BucketName, key).AccessControlList.Grants; Utils.AssertTrue(GrantsDoNotContain(grants, AuthenticatedUsersUriSubstring)); Utils.AssertTrue(GrantsDoNotContain(grants, AllUsersUriSubstring)); Utils.AssertTrue(GrantsDoNotContain(grants, LogDeliveryUriSubstring)); // Private S3TestUtils.PostObjectHelper(Client, BucketName, key, delegate(PostObjectRequest request) { request.CannedACL = S3CannedACL.Private; }); grants = S3TestUtils.GetACLHelper(Client, BucketName, key).AccessControlList.Grants; Utils.AssertTrue(GrantsDoNotContain(grants, AuthenticatedUsersUriSubstring)); Utils.AssertTrue(GrantsDoNotContain(grants, AllUsersUriSubstring)); Utils.AssertTrue(GrantsDoNotContain(grants, LogDeliveryUriSubstring)); S3TestUtils.DeleteObjectHelper(Client, BucketName, key); }
private void SimplePostTestInner() { AutoResetEvent ars = new AutoResetEvent(false); Exception responseException = new Exception(); VersionStatus status = null; Client.GetBucketVersioningAsync(new GetBucketVersioningRequest() { BucketName = BucketName }, (response) => { responseException = response.Exception; if (responseException == null) { status = response.Response.VersioningConfig.Status; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); Assert.IsNull(responseException); Assert.AreEqual(VersionStatus.Off, status); List <S3Object> s3Objects = S3TestUtils.ListObjectsHelper(Client, BucketName); Assert.IsNotNull(s3Objects); var count = s3Objects.Count; var key = string.Format(FileNameFormat, DateTime.Now.Ticks); S3TestUtils.PostObjectHelper(Client, BucketName, key); s3Objects = S3TestUtils.ListObjectsHelper(Client, BucketName); Assert.IsNotNull(s3Objects); Assert.AreEqual(count + 1, s3Objects.Count); S3TestUtils.DeleteObjectHelper(Client, BucketName, key); s3Objects = S3TestUtils.ListObjectsHelper(Client, BucketName); Assert.IsNotNull(s3Objects); Assert.AreEqual(count, s3Objects.Count); }
public void TestSingleUploads() { // Test simple PostObject upload var objectKey = "contentbodyput" + DateTime.Now.Ticks; S3TestUtils.PostObjectHelper(Client, BucketName, objectKey, SetMetadata); var response = S3TestUtils.GetObjectHelper(Client, BucketName, objectKey); S3TestUtils.DeleteObjectHelper(Client, BucketName, objectKey); var prefixLen = "x-amz-meta-".Length; foreach (var fullKey in response.Metadata.Keys) { // remove x-amz-meta-, ignoring case var shortKey = fullKey.StartsWith("x-amz-meta-", StringComparison.OrdinalIgnoreCase) ? fullKey.Substring(prefixLen, fullKey.Length - prefixLen) : fullKey; var actualValue = response.Metadata[fullKey]; var expectedValue = Metadata[shortKey]; Assert.AreEqual(expectedValue, actualValue); } }