Class S3ObjectInfoProvider
- Namespace
- Kentico.Xperience.AmazonStorage
- Assembly
- Kentico.Xperience.AmazonStorage.dll
Performs operations over the S3 objects.
public class S3ObjectInfoProvider : IS3ObjectInfoProvider
- Inheritance
-
objectS3ObjectInfoProvider
- 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
Methods
AppendTextToObject(IS3ObjectInfo, string)
Appends text to Amazon S3 storage object.
public void AppendTextToObject(IS3ObjectInfo obj, string content)
Parameters
obj
IS3ObjectInfoObject info.
content
stringContent to append.
CopyObjects(IS3ObjectInfo, IS3ObjectInfo)
Copies object to another.
public void CopyObjects(IS3ObjectInfo sourceObject, IS3ObjectInfo destObject)
Parameters
sourceObject
IS3ObjectInfoSource object info.
destObject
IS3ObjectInfoDestination object info.
CreateEmptyObject(IS3ObjectInfo)
Creates empty object.
public void CreateEmptyObject(IS3ObjectInfo obj)
Parameters
obj
IS3ObjectInfoObject info.
DeleteObject(IS3ObjectInfo)
Deletes object from Amazon S3 storage.
public void DeleteObject(IS3ObjectInfo obj)
Parameters
obj
IS3ObjectInfoObject info.
GetBucketName(string)
Returns bucket name from account info.
public static string GetBucketName(string path)
Parameters
path
stringPath 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
DateTimeDate time.
Returns
- string
GetInfo(string)
Returns new instance of IS3ObjectInfo.
public IS3ObjectInfo GetInfo(string path)
Parameters
path
stringPath with file name.
Returns
GetInfo(string, bool)
Initializes new instance of S3 object info with specified bucket name.
public IS3ObjectInfo GetInfo(string path, bool key)
Parameters
path
stringPath with file name.
key
boolSpecifies that given path is already object key.
Returns
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
IS3ObjectInfoObject info.
fileMode
FileModeFile mode.
fileAccess
FileAccessFile access.
fileShare
FileShareSharing permissions.
bufferSize
intBuffer 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
stringPath.
type
ObjectTypeEnumSpecifies which objects are returned (files, directories, both).
useFlatListing
boolWhether flat listing is used (all files from all subdirectories all in the result).
lower
boolSpecifies whether path should be lowered inside method.
useCache
boolIndicates 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
stringString date time.
Returns
- DateTime
ObjectExists(IS3ObjectInfo)
Returns whether object exists.
public bool ObjectExists(IS3ObjectInfo obj)
Parameters
obj
IS3ObjectInfoObject info.
Returns
- bool
PutDataFromStreamToObject(IS3ObjectInfo, Stream)
Puts data from stream to Amazon S3 storage.
public void PutDataFromStreamToObject(IS3ObjectInfo obj, Stream stream)
Parameters
obj
IS3ObjectInfoObject info.
stream
StreamStream to upload.
PutFileToObject(IS3ObjectInfo, string)
Puts local file to Amazon S3 storage.
public void PutFileToObject(IS3ObjectInfo obj, string pathToSource)
Parameters
obj
IS3ObjectInfoObject info.
pathToSource
stringPath 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
IS3ObjectInfoObject info.
content
stringContent to add.