Added support for S3 storage classes (#28319)

* Added support for S3 storage classes

* Added missing translations for S3 storage class

* Changed default storage class values to preserve original behaviour

* Changed storage class description and example

* Fix translations ordering

* Change configuration defaults to empty strings

* Remove redundant empty string check

* Validate storage class variable against constants from S3 API docs

* Validate export storage class against constants

* Use slices for config validation

* Applied patch for translation ordering
Этот коммит содержится в:
Nadav Tasher
2024-11-13 08:59:44 +02:00
коммит произвёл GitHub
родитель 8c3f4a5818
Коммит 5e47c97db4
12 изменённых файлов: 86 добавлений и 5 удалений

Просмотреть файл

@@ -1097,6 +1097,17 @@ const AdminDefinition: AdminDefinitionType = {
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: 'text',
key: 'FileSettings.AmazonS3StorageClass',
label: defineMessage({id: 'admin.image.amazonS3StorageClassTitle', defaultMessage: 'Amazon S3 Storage Class:'}),
help_text: defineMessage({id: 'admin.image.amazonS3StorageClassDescription', defaultMessage: 'Storage class for your S3 Compatible Storage provider. Defaults to empty.'}),
placeholder: defineMessage({id: 'admin.image.amazonS3StorageClassExample', defaultMessage: 'E.g.: "STANDARD" or "STANDARD_IA"'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.ENVIRONMENT.FILE_STORAGE)),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: 'button',
action: testS3Connection,
@@ -1281,6 +1292,17 @@ const AdminDefinition: AdminDefinitionType = {
it.stateEquals('FileSettings.DedicatedExportStore', false),
),
},
{
type: 'text',
key: 'FileSettings.ExportAmazonS3StorageClass',
label: defineMessage({id: 'admin.image.amazonS3StorageClassTitle', defaultMessage: 'Amazon S3 Storage Class:'}),
help_text: defineMessage({id: 'admin.image.amazonS3StorageClassDescription', defaultMessage: 'Storage class for your S3 Compatible Storage provider. Defaults to empty.'}),
placeholder: defineMessage({id: 'admin.image.amazonS3StorageClassExample', defaultMessage: 'E.g.: "STANDARD" or "STANDARD_IA"'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.ENVIRONMENT.FILE_STORAGE)),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: 'button',
action: testS3Connection,

Просмотреть файл

@@ -1153,6 +1153,9 @@
"admin.image.amazonS3SSETitle": "Enable Server-Side Encryption for Amazon S3:",
"admin.image.amazonS3SSLDescription": "When false, allow insecure connections to Amazon S3. Defaults to secure connections only.",
"admin.image.amazonS3SSLTitle": "Enable Secure Amazon S3 Connections:",
"admin.image.amazonS3StorageClassDescription": "Storage class for your S3 Compatible Storage provider. Defaults to empty.",
"admin.image.amazonS3StorageClassExample": "E.g.: \"STANDARD\" or \"STANDARD_IA\"",
"admin.image.amazonS3StorageClassTitle": "Amazon S3 Storage Class:",
"admin.image.amazonS3TraceDescription": "(Development Mode) When true, log additional debugging information to the system logs.",
"admin.image.amazonS3TraceTitle": "Enable Amazon S3 Debugging:",
"admin.image.archiveRecursionDescription": "When enabled, content of documents within ZIP files will be returned in search results. This may have an impact on server performance for large files.",

Просмотреть файл

@@ -544,6 +544,7 @@ export type FileSettings = {
AmazonS3Trace: boolean;
AmazonS3RequestTimeoutMilliseconds: number;
AmazonS3UploadPartSizeBytes: number;
AmazonS3StorageClass: string;
DedicatedExportStore: boolean;
ExportDriverName: string;
ExportDirectory: string;
@@ -560,6 +561,7 @@ export type FileSettings = {
ExportAmazonS3RequestTimeoutMilliseconds: number;
ExportAmazonS3PresignExpiresSeconds: number;
ExportAmazonS3UploadPartSizeBytes: number;
ExportAmazonS3StorageClass: string;
};
export type EmailSettings = {