S3Manager Class

Summary

Provides a high level utility for managing transfers to and from Amazon S3. It makes extensive use of Amazon S3 multipart uploads to achieve enhanced throughput, performance, and reliability. When uploading large files by specifying file paths instead of a stream, TransferUtility uses multiple threads to upload multiple parts of a single upload at once. When dealing with large content sizes and high bandwidth, this can increase throughput significantly.
Assembly
Cake.AWS.S3.dll
Namespace
Cake.AWS.S3
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IS3Manager"] click Interface0 "/api/Cake.AWS.S3/IS3Manager" Type["S3Manager"] class Type type-node

Syntax

public class S3Manager : IS3Manager

Constructors

Name Summary
S3Manager(IFileSystem, ICakeEnvironment, ICakeLog) Initializes a new instance of the S3Manager class.

Properties

Name Value Summary
LogProgress bool
If the manager should output progrtess events to the cake log

Methods

Name Value Summary
Delete(IList<string>, S3Settings, CancellationToken) Task
Deletes a collection of files to S3. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
Delete(string, string, S3Settings, CancellationToken) Task
Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects.
DeleteAll(string, DateTimeOffset, S3Settings, CancellationToken) Task<IList<string>>
Removes all objects from the bucket
Download(FilePath, string, string, DownloadSettings, CancellationToken) Task
Downloads the content from Amazon S3 and writes it to the specified file.
Download(IList<SyncPath>, SyncSettings, CancellationToken) Task
Downloads a collection of files from S3 and writes ithem to the specified files.
GenerateEncryptionKey(FilePath, int) void
Generates a base64-encoded encryption key for Amazon S3 to use to encrypt / decrypt objects
GetBytes(string, string, DownloadSettings, CancellationToken) Task<byte[]>
Get the byte array of the content from Amazon S3
GetHash(IFile) string
Gets the hash of a file
GetObject(string, string, S3Settings, CancellationToken) Task<S3Object>
Retrieves object from Amazon S3.
GetObjectMetaData(string, string, S3Settings, CancellationToken) Task<MetadataCollection>
Retrieves object Metadata from Amazon S3.
GetObjects(string, S3Settings, CancellationToken) Task<IList<S3Object>>
Returns all the objects in a S3 bucket.
GetPreSignedURL(string, string, DateTime, S3Settings) string
Create a signed URL allowing access to a resource that would usually require authentication. cts
Open(string, string, DownloadSettings, CancellationToken) Task<Stream>
Opens a stream of the content from Amazon S3
SyncDownload(DirectoryPath, SyncSettings, CancellationToken) Task<IList<string>>
Syncs the specified directory from Amazon S3, checking the modified date of the local files with existing S3Objects and downloading them if its changed.
SyncDownload(FilePath, SyncSettings, CancellationToken) Task<string>
Syncs the specified file from Amazon S3, checking the modified date of the local files with existing S3Objects and downloading them if its changed.
SyncUpload(DirectoryPath, SyncSettings, CancellationToken) Task<IList<string>>
Syncs the specified directory to Amazon S3, checking the modified date of the local files with existing S3Objects and uploading them if its changes.
SyncUpload(FilePath, SyncSettings, CancellationToken) Task<string>
Syncs the specified file to Amazon S3, checking the modified date of the local files with existing S3Objects and uploading them if its changes.
Upload(FilePath, string, UploadSettings, CancellationToken) Task
Uploads the specified file. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
Upload(IList<SyncPath>, SyncSettings, CancellationToken) Task
Uploads a collection of files to S3. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
Upload(Stream, string, UploadSettings, CancellationToken) Task
Uploads the contents of the specified stream. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
UploadCompressed(FilePath, string, UploadSettings, CancellationToken) Task
Uploads the specified file. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
UploadUnCompressed(FilePath, string, UploadSettings, CancellationToken) Task
Uploads the specified file. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Extension Methods

Name Value Summary
Dump<S3Manager>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<S3Manager>(S3Manager[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<S3Manager>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Issues addin
NotNull<S3Manager>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
ThrowIfNull<S3Manager>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<S3Manager>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin