AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Provides utilities used by the Amazon S3 client implementation. These utilities might be useful to consumers of the Amazon S3 library.

Inheritance Hierarchy

System.Object
  Amazon.S3.Util.AmazonS3Util

Namespace: Amazon.S3.Util
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z

Syntax

C#
public static class AmazonS3Util

The AmazonS3Util type exposes the following members

Properties

NameTypeDescription
Public Property Static Property FormattedCurrentTimestamp System.String

Formats the current date as a GMT timestamp

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method Static Method ConvertToS3StorageClass(string)

Converts the string representing a storage class that would come back from a ListObjects request to the S3StorageClass enumeration.

Public Method Static Method DeleteS3BucketWithObjects(IAmazonS3, string)

Deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjects(IAmazonS3, string, S3DeleteBucketWithObjectsOptions)

Deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjectsAsync(IAmazonS3, string)

Deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjectsAsync(IAmazonS3, string, S3DeleteBucketWithObjectsOptions)

Deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjectsAsync(IAmazonS3, string, CancellationToken)

Initiates the asynchronous execution of the DeleteS3BucketWithObjects operation. DeleteS3BucketWithObjects deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjectsAsync(IAmazonS3, string, S3DeleteBucketWithObjectsOptions, CancellationToken)

Initiates the asynchronous execution of the DeleteS3BucketWithObjects operation. DeleteS3BucketWithObjects deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DeleteS3BucketWithObjectsAsync(IAmazonS3, string, S3DeleteBucketWithObjectsOptions, Action<S3DeleteBucketWithObjectsUpdate>, CancellationToken)

Initiates the asynchronous execution of the DeleteS3BucketWithObjects operation. DeleteS3BucketWithObjects deletes an S3 bucket which contains objects. An S3 bucket which contains objects cannot be deleted until all the objects in it are deleted. This method deletes all the objects in the specified bucket and then deletes the bucket itself.

Public Method Static Method DoesS3BucketExist(IAmazonS3, string)

Determines whether an S3 bucket exists or not. This is done by: 1. Creating a PreSigned Url for the bucket. To work with Signature V4 only regions, as well as Signature V4-optional regions, we keep the expiry to within the maximum for V4 (which is one week). 2. Making a HEAD request to the Url

Public Method Static Method DoesS3BucketExistAsync(IAmazonS3, string)

Determines whether an S3 bucket exists or not. This is done by: 1. Creating a PreSigned Url for the bucket. To work with Signature V4 only regions, as well as Signature V4-optional regions, we keep the expiry to within the maximum for V4 (which is one week). 2. Making a HEAD request to the Url

Public Method Static Method DoesS3BucketExistV2(IAmazonS3, string)

Determines whether an S3 bucket exists or not.

Public Method Static Method DoesS3BucketExistV2Async(IAmazonS3, string)

Determines whether an S3 bucket exists or not.

Public Method Static Method GenerateChecksumForContent(string, bool)

Generates an MD5 Digest for the string-based content

Public Method Static Method GenerateMD5ChecksumForStream(Stream)

Generates an MD5 Digest for the stream specified

Public Method Static Method IsDirectoryBucket(IRequest)

Check if the backend is S3Express

Public Method Static Method MakeStreamSeekable(Stream)

Converts a non-seekable stream into a System.IO.MemoryStream. A MemoryStream's position can be moved arbitrarily

Public Method Static Method MimeTypeFromExtension(string)

Determines MIME type from a file extension

Public Method Static Method PostUpload(S3PostUploadRequest)

Upload data to Amazon S3 using HTTP POST.

Public Method Static Method SetObjectStorageClass(IAmazonS3, string, string, S3StorageClass)

Sets the storage class for the S3 Object to the value specified.

Public Method Static Method SetObjectStorageClass(IAmazonS3, string, string, string, S3StorageClass)

Sets the storage class for the S3 Object's Version to the value specified.

Public Method Static Method SetServerSideEncryption(IAmazonS3, string, string, ServerSideEncryptionMethod)

Sets the server side encryption method for the S3 Object to the value specified.

Public Method Static Method SetServerSideEncryption(IAmazonS3, string, string, string, ServerSideEncryptionMethod)

Sets the server side encryption method for the S3 Object's Version to the value specified.

Public Method Static Method SetWebsiteRedirectLocation(IAmazonS3, string, string, string)

Sets the redirect location for the S3 Object's when being accessed through the S3 website endpoint.

Public Method Static Method UrlEncode(string, bool)

URL encodes a string. If the path property is specified, the accepted path characters {/+:} are not encoded.

Public Method Static Method UseS3ExpressSessionAuth(IRequest)

Check if the request should use S3Express session authentication

Public Method Static Method ValidateV2Bucket(string)

Version2 S3 buckets adhere to RFC 1035: Less than 255 characters, with each label less than 63 characters.Label must start with a letterLabel must end with a letter or digitLabel can have a string of letter, digits and hyphens in the middle.Although names can be case-sensitive, no significance is attached to the case.RFC 1123: Allow label to start with letter or digit (e.g. 3ware.com works)RFC 2181: No restrictions apart from the length restrictions. S3 V2 will start with RFCs 1035 and 1123 and impose the following additional restrictions: Length between 3 and 63 characters (to allow headroom for upper-level domains, as well as to avoid separate length restrictions for bucket-name and its labelsOnly lower-case to avoid user confusion.No dotted-decimal IPv4-like strings

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5