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
objIS3ObjectInfoObject info.
contentstringContent to append.
CopyObjects(IS3ObjectInfo, IS3ObjectInfo)
Copies object to another.
public void CopyObjects(IS3ObjectInfo sourceObject, IS3ObjectInfo destObject)
Parameters
sourceObjectIS3ObjectInfoSource object info.
destObjectIS3ObjectInfoDestination object info.
CreateEmptyObject(IS3ObjectInfo)
Creates empty object.
public void CreateEmptyObject(IS3ObjectInfo obj)
Parameters
objIS3ObjectInfoObject info.
DeleteObject(IS3ObjectInfo)
Deletes object from Amazon S3 storage.
public void DeleteObject(IS3ObjectInfo obj)
Parameters
objIS3ObjectInfoObject info.
GetBucketName(string)
Returns bucket name from account info.
public static string GetBucketName(string path)
Parameters
pathstringPath 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
datetimeDateTimeDate time.
Returns
- string
GetInfo(string)
Returns new instance of IS3ObjectInfo.
public IS3ObjectInfo GetInfo(string path)
Parameters
pathstringPath 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
pathstringPath with file name.
keyboolSpecifies 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
objIS3ObjectInfoObject info.
fileModeFileModeFile mode.
fileAccessFileAccessFile access.
fileShareFileShareSharing permissions.
bufferSizeintBuffer 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
pathstringPath.
typeObjectTypeEnumSpecifies which objects are returned (files, directories, both).
useFlatListingboolWhether flat listing is used (all files from all subdirectories all in the result).
lowerboolSpecifies whether path should be lowered inside method.
useCacheboolIndicates 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
datetimestringString date time.
Returns
- DateTime
ObjectExists(IS3ObjectInfo)
Returns whether object exists.
public bool ObjectExists(IS3ObjectInfo obj)
Parameters
objIS3ObjectInfoObject info.
Returns
- bool
PutDataFromStreamToObject(IS3ObjectInfo, Stream)
Puts data from stream to Amazon S3 storage.
public void PutDataFromStreamToObject(IS3ObjectInfo obj, Stream stream)
Parameters
objIS3ObjectInfoObject info.
streamStreamStream to upload.
PutFileToObject(IS3ObjectInfo, string)
Puts local file to Amazon S3 storage.
public void PutFileToObject(IS3ObjectInfo obj, string pathToSource)
Parameters
objIS3ObjectInfoObject info.
pathToSourcestringPath 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
objIS3ObjectInfoObject info.
contentstringContent to add.