Amazon.S3.AmazonS3Client.DeleteObjectAsync C# (CSharp) Метод

DeleteObjectAsync() публичный Метод

Initiates the asynchronous execution of the DeleteObject operation.
public DeleteObjectAsync ( DeleteObjectRequest request, System cancellationToken = default(CancellationToken) ) : Task
request Amazon.S3.Model.DeleteObjectRequest Container for the necessary parameters to execute the DeleteObject operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
Результат Task
        public Task<DeleteObjectResponse> DeleteObjectAsync(DeleteObjectRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteObjectRequestMarshaller();
            var unmarshaller = DeleteObjectResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteObjectRequest,DeleteObjectResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }

Same methods

AmazonS3Client::DeleteObjectAsync ( string bucketName, string key, System cancellationToken = default(CancellationToken) ) : Task
AmazonS3Client::DeleteObjectAsync ( string bucketName, string key, string versionId, System cancellationToken = default(CancellationToken) ) : Task
AmazonS3Client::DeleteObjectAsync ( DeleteObjectRequest request, DeleteObjectResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
AmazonS3Client::DeleteObjectAsync ( string bucketName, string key, DeleteObjectResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
AmazonS3Client::DeleteObjectAsync ( string bucketName, string key, string versionId, DeleteObjectResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

Пример #1
0
        public static async System.Threading.Tasks.Task <bool> Delete(this string fileNameGuid, string _awsAccessKey, string _awsSecretKey, string _bucketName)
        {
            IAmazonS3 client;
            var       s3Client = RegionEndpoint.USEast1;

            try
            {
                using (client = new Amazon.S3.AmazonS3Client(_awsAccessKey, _awsSecretKey, s3Client))
                {
                    DeleteObjectRequest request = new DeleteObjectRequest()
                    {
                        BucketName = _bucketName,
                        Key        = fileNameGuid,
                    };

                    await client.DeleteObjectAsync(request);

                    client.Dispose();
                }
            }
            catch (Exception exception)
            {
                Logging.Log("Upload Documents failure", "S3 File upload Extension Method", exception);
                return(false);
            }

            return(true);
        }
All Usage Examples Of Amazon.S3.AmazonS3Client::DeleteObjectAsync
AmazonS3Client