NAME
Kernel::System::Ticket::Article::Backend::MIMEBase::ArticleStorageObjectFS – S3 compatible object file system based ticket article storage interface
DESCRIPTION
This class provides functions to manipulate ticket articles in a S3 compatible object file system. Inherits from Kernel::System::Ticket::Article::Backend::MIMEBase::Base.
The S3 service and operations are based on https://metacpan.org/pod/Paws and the related subsystem.
$Self->{'Ticket::Article::Backend::MIMEBase::ArticleStorage'} = 'Kernel::System::Ticket::Article::Backend::MIMEBase::ArticleStorageObjectFS';
$Self->{'Ticket::Article::Backend::MIMEBase::ArticleStorageObjectFS'} = {
Endpoint => 'http://127.0.0.1:9000',
Region => 'local',
AwsAccessKey => 'minioadmin',
AwsSecretKey => 'minioadmin',
Bucket => 'storage',
HealthCheck => '/minio/health/live',
MaxObjectSize => 1024 * 1024 * 20,
};
PUBLIC INTERFACE
has Config
Attribute that holds the object related configuration.
- Endpoint
-
An URL (string) representing HTTP requests base endpoint, optional.
- Region
-
A string representing the region that service objects will be instantiated with.
- Bucket
-
A string representing the logical container of objects.
- AwsAccessKey
-
A string representing a "login" which grants programmatic access to your resources.
- AwsSecretKey
-
A string representing a "secret" which grants programmatic access to your resources.
- HealthCheck
-
A string representing a (relative) URL path for a service health / alive check, optional.
- MaxObjectSize
-
An integer representing a value in bytes to limit the size of a single object, optional.
The size MUST fit between 5 MiB and default 100 MiB.
has Encode
Atrribute that holds an encode object reference which handles methods DecodeBase64
, EncodeBase64
.
has Log
Attribute that holds a log object reference which handles method Log
.
has Service
Attribute that holds the instantiated Paws::S3 service object.
BUILD
Set maximal upload part size.
CAVEAT! Validation and default value setting should be configured in XML config when S3 compatible article storage is official supported.
ServiceIsAlive
Check if service is reachable.
Returns true on success and false on failure (additional error logging). Returns always true if HealtCheck
or Endpoint
configuration setting is not defined. If latter is missing, we assume it's an origin Amazon S3 service endpoint derived by the the Region
configuration setting. Such an endpoint is "always" available.
Setup
Build and return Paws::S3 service object. Verify connection to storage Endpoint
and create Bucket
if not existing. On any service issue the construction of an object of this class will fail with an exception.
ArticleAttachment
Fetch single article attachment meta information and content.
my %Attachment = $BackendObject->ArticleAttachment(
ArticleID => 42,
FileID => 1,
);
Returns:
my %Attachment = {
Content => "...",
ContentAlternative => "",
ContentID => "",
ContentType => "image/jpeg",
Disposition => "attachment",
Filename => "nice.jpeg",
FilesizeRaw => 3531669,
Key => "576/attachments/d1ede6ce808b459f2484d53709c3dc7f",
}
ArticleAttachmentIndexRaw
List meta information of all article related attachments.
my %AttachmentsMetaInfo = $BackendObject->ArticleAttachmentIndexRaw(
ArticleID => 42,
);
Returns:
%AttachmentsMetaInfo = {
1 => {
ContentAlternative => "",
ContentID => "",
ContentType => "image/jpeg",
Disposition => "attachment",
Filename => "nicer.jpeg",
FilesizeRaw => 313001,
Key => "576/attachments/35a3e518b4e1ea4bc5b6621a6b6a8b5b",
},
2 => {
ContentAlternative => "",
ContentID => "",
ContentType => "image/jpeg",
Disposition => "attachment",
Filename => "nice.jpeg",
FilesizeRaw => 3531669,
Key => "576/attachments/d1ede6ce808b459f2484d53709c3dc7f",
},
3 => {
ContentAlternative => "",
ContentID => "",
ContentType => "text/plain; charset=utf-8",
Disposition => "inline",
Filename => "file-1",
FilesizeRaw => 14,
Key => "576/attachments/df0f9df5365af2a12c38974f665500ac",
}
};
ArticleDelete
Delete all article related attachments and plain article file.
$BackendObject->ArticleDelete(
ArticleID => 42
);
Returns true on success and false on any failure (see OTRS log for further information).
ArticleDeleteAttachment
Delete all article related attachments.
$BackendObject->ArticleDeleteAttachment(
ArticleID => 42
);
Returns true on success and false on any failure (see OTRS log for further information).
ArticleDeletePlain
Delete plain article file.
$BackendObject->ArticleDeletePlain(
ArticleID => 42
);
Returns true on success and false on any failure (see OTRS log for further information).
ArticlePlain
Fetch plain article file (email) content.
my $PlainArticle = $BackendObject->ArticlePlain(
ArticleID => 42,
);
ArticleWriteAttachment
Store article attachment.
$BackendObject->ArticleWriteAttachment(
ArticleID => 42,
Filename => 'nice.jpeg',
ContentType => 'image/jpeg',
Content => '...', # (optional) attachment content
Disposition => 'attachment', # (optional) 'inline' or 'attachment'
ContentID => '' # (optional) content reference
);
Returns true on success and false on any failure (see OTRS log for further information).
ArticleWritePlain
Store plain article.
$BackendObject->AerticleWritePlain(
ArticleID => 42,
Email => '...'
);
Returns true on success and false on any failure (see OTRS log for further information).
Execute
Thin wrapper around S3 service method with exception handling, debug and error logging.