Table of Contents

Class S3ObjectInfoProvider

Namespace
Kentico.Xperience.AmazonStorage
Assembly
Kentico.Xperience.AmazonStorage.dll

Performs operations over the S3 objects.

public class S3ObjectInfoProvider : IS3ObjectInfoProvider
Inheritance
object
S3ObjectInfoProvider
Implements
Extension Methods

Fields

ATTRIBUTES

Attributes field name in storage metadata.

public const string ATTRIBUTES = "Attributes"

Field Value

string

CREATION_TIME

Creation time field name in storage metadata.

public const string CREATION_TIME = "CreationTime"

Field Value

string

LAST_WRITE_TIME

Last write time field name in storage metadata.

public const string LAST_WRITE_TIME = "LastWriteTime"

Field Value

string

LOCK

Property name which returns if file is locked for writing.

public const string LOCK = "Lock"

Field Value

string

MAX_OBJECTS_PER_REQUEST

Indicates maximum number of items processed by one request.

public const int MAX_OBJECTS_PER_REQUEST = 1000

Field Value

int

Properties

Current

Returns current instance of S3ObjectInfo provider.

public static IS3ObjectInfoProvider Current { get; }

Property Value

IS3ObjectInfoProvider

Methods

AppendTextToObject(IS3ObjectInfo, string)

Appends text to Amazon S3 storage object.

public void AppendTextToObject(IS3ObjectInfo obj, string content)

Parameters

obj IS3ObjectInfo

Object info.

content string

Content to append.

CopyObjects(IS3ObjectInfo, IS3ObjectInfo)

Copies object to another.

public void CopyObjects(IS3ObjectInfo sourceObject, IS3ObjectInfo destObject)

Parameters

sourceObject IS3ObjectInfo

Source object info.

destObject IS3ObjectInfo

Destination object info.

CreateEmptyObject(IS3ObjectInfo)

Creates empty object.

public void CreateEmptyObject(IS3ObjectInfo obj)

Parameters

obj IS3ObjectInfo

Object info.

DeleteObject(IS3ObjectInfo)

Deletes object from Amazon S3 storage.

public void DeleteObject(IS3ObjectInfo obj)

Parameters

obj IS3ObjectInfo

Object info.

GetBucketName(string)

Returns bucket name from account info.

public static string GetBucketName(string path)

Parameters

path string

Path for which is bucket name returned.

Returns

string

GetDateTimeString(DateTime)

Returns date time as a string type in english culture.

public static string GetDateTimeString(DateTime datetime)

Parameters

datetime DateTime

Date time.

Returns

string

GetInfo(string)

Returns new instance of IS3ObjectInfo.

public IS3ObjectInfo GetInfo(string path)

Parameters

path string

Path with file name.

Returns

IS3ObjectInfo

GetInfo(string, bool)

Initializes new instance of S3 object info with specified bucket name.

public IS3ObjectInfo GetInfo(string path, bool key)

Parameters

path string

Path with file name.

key bool

Specifies that given path is already object key.

Returns

IS3ObjectInfo

GetObjectContent(IS3ObjectInfo, FileMode, FileAccess, FileShare, int)

Returns object content as a stream.

public Stream GetObjectContent(IS3ObjectInfo obj, FileMode fileMode = FileMode.Open, FileAccess fileAccess = FileAccess.Read, FileShare fileShare = FileShare.ReadWrite, int bufferSize = 4096)

Parameters

obj IS3ObjectInfo

Object info.

fileMode FileMode

File mode.

fileAccess FileAccess

File access.

fileShare FileShare

Sharing permissions.

bufferSize int

Buffer size.

Returns

Stream

GetObjectsList(string, ObjectTypeEnum, bool, bool, bool)

Returns list with objects from given bucket and under given path.

public List<string> GetObjectsList(string path, ObjectTypeEnum type, bool useFlatListing = false, bool lower = true, bool useCache = true)

Parameters

path string

Path.

type ObjectTypeEnum

Specifies which objects are returned (files, directories, both).

useFlatListing bool

Whether flat listing is used (all files from all subdirectories all in the result).

lower bool

Specifies whether path should be lowered inside method.

useCache bool

Indicates if results should be primary taken from cache to get better performance

Returns

List<string>

Remarks

In order to allow to distinguish between files and directories, directories are listed with a trailing backslash.

GetStringDateTime(string)

Returns date time as a DateTime type converted using english culture.

public static DateTime GetStringDateTime(string datetime)

Parameters

datetime string

String date time.

Returns

DateTime

ObjectExists(IS3ObjectInfo)

Returns whether object exists.

public bool ObjectExists(IS3ObjectInfo obj)

Parameters

obj IS3ObjectInfo

Object info.

Returns

bool

PutDataFromStreamToObject(IS3ObjectInfo, Stream)

Puts data from stream to Amazon S3 storage.

public void PutDataFromStreamToObject(IS3ObjectInfo obj, Stream stream)

Parameters

obj IS3ObjectInfo

Object info.

stream Stream

Stream to upload.

PutFileToObject(IS3ObjectInfo, string)

Puts local file to Amazon S3 storage.

public void PutFileToObject(IS3ObjectInfo obj, string pathToSource)

Parameters

obj IS3ObjectInfo

Object info.

pathToSource string

Path to local file.

Remarks

For uploading a file from different file system other than local file system to Amazon S3 storage, PutDataFromStreamToObject(IS3ObjectInfo, Stream) method should be used.

PutTextToObject(IS3ObjectInfo, string)

Puts text to Amazon S3 storage object.

public void PutTextToObject(IS3ObjectInfo obj, string content)

Parameters

obj IS3ObjectInfo

Object info.

content string

Content to add.