AWSSDK.IntegrationTests.S3.S3TestUtils.DeleteObjectHelper C# (CSharp) Метод

DeleteObjectHelper() публичный статический Метод

public static DeleteObjectHelper ( AmazonS3Client client, string bucketName, string key, string versionId = null ) : void
client Amazon.S3.AmazonS3Client
bucketName string
key string
versionId string
Результат void
        public static void DeleteObjectHelper(AmazonS3Client client, string bucketName, string key, string versionId = null)
        {
            Exception responseException = null;
            AutoResetEvent ars = new AutoResetEvent(false);
            client.DeleteObjectsAsync(new DeleteObjectsRequest()
            {
                BucketName = bucketName,
                Objects = new List<KeyVersion> { new KeyVersion() { Key = key, VersionId = versionId } }
            }, (response) =>
            {
                responseException = response.Exception;
                ars.Set();
            }, new AsyncOptions { ExecuteCallbackOnMainThread = false });
            ars.WaitOne();
            Assert.IsNull(responseException);
        }

Usage Example

Пример #1
0
        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);
        }
All Usage Examples Of AWSSDK.IntegrationTests.S3.S3TestUtils::DeleteObjectHelper