Table of Contents

Class S3Link

Namespace
Amazon.DynamoDBv2.DataModel
Assembly
AWSSDK.DynamoDBv2.dll

S3Link is an object that provides a connection to an S3 resource that can be stored in a DynamoDB field through DynamoDBContext

public class S3Link
Inheritance
S3Link
Inherited Members

Properties

The name of the target Bucket for the managed resource

public string BucketName { get; set; }

Property Value

string

The Key that S3Link stores and downloads a resource to and from

public string Key { get; set; }

Property Value

string

The region the S3 resource is in

public string Region { get; set; }

Property Value

string

Looks up RegionEndpoint based on region as a string

public RegionEndpoint RegionAsEndpoint { get; }

Property Value

RegionEndpoint

Methods

Creates an S3Link that can be used to managed an S3 connection

public static S3Link Create(DynamoDBContext context, string bucket, string key, RegionEndpoint region)

Parameters

context DynamoDBContext

The context that is handling the S3Link

bucket string

The bucket the S3Link should manage

key string

The key that S3Link should store and download from

region RegionEndpoint

The region of the S3 resource

Returns

S3Link

A new S3Link object that can upload and download to the target bucket

Downloads the file from the S3Link's specified bucket and key then saves it in the given path. Creates directories and the file if they do not already exist.

public Task DownloadToAsync(string downloadPath, CancellationToken cancellationToken = default)

Parameters

downloadPath string

Path to save the file.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task

An asynchronous task of the request

Provides a URL for accessing the S3 object managed by S3Link

public string GetPreSignedURL(DateTime expiration)

Parameters

expiration DateTime

The time the link should become invalid

Returns

string

A URL directing to the S3 object

Opens a stream to object stored in Amazon S3.

public Task<Stream> OpenStreamAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<Stream>

An asynchronous task of the request

Uploads the specified file and stores it in the specified bucket with the provided key from construction.

public Task UploadFromAsync(string sourcePath, CancellationToken cancellationToken = default)

Parameters

sourcePath string

Path of the file to be uploaded.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task

An asynchronous task of the request

Uploads the stream and stores it in the specified bucket with the provided key from construction.

public Task UploadStreamAsync(Stream stream, CancellationToken cancellationToken = default)

Parameters

stream Stream

Stream to be uploaded to Amazon S3.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task

An asynchronous task of the request