mirror of https://github.com/apache/nifi.git
NIFI-11408 enable user to disable gzip compression with PutGCSObject
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #7139.
This commit is contained in:
parent
21e4c665dc
commit
4414793f2a
|
@ -194,6 +194,15 @@ public class PutGCSObject extends AbstractGCSProcessor {
|
|||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.build();
|
||||
|
||||
public static final PropertyDescriptor GZIPCONTENT = new PropertyDescriptor
|
||||
.Builder().name("gzip.content.enabled")
|
||||
.displayName("GZIP Compression Enabled")
|
||||
.description("Signals to the GCS Blob Writer whether GZIP compression during transfer is desired. " +
|
||||
"False means do not gzip and can boost performance in many cases.")
|
||||
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
|
||||
.allowableValues(Boolean.TRUE.toString(), Boolean.FALSE.toString())
|
||||
.defaultValue(Boolean.TRUE.toString())
|
||||
.build();
|
||||
public static final AllowableValue ACL_ALL_AUTHENTICATED_USERS = new AllowableValue(
|
||||
ALL_AUTHENTICATED_USERS.name(), "All Authenticated Users", "Gives the bucket or object owner OWNER " +
|
||||
"permission, and gives all authenticated Google account holders READER and WRITER permissions. " +
|
||||
|
@ -299,6 +308,7 @@ public class PutGCSObject extends AbstractGCSProcessor {
|
|||
descriptors.add(ENCRYPTION_KEY);
|
||||
descriptors.add(OVERWRITE);
|
||||
descriptors.add(CONTENT_DISPOSITION_TYPE);
|
||||
descriptors.add(GZIPCONTENT);
|
||||
return Collections.unmodifiableList(descriptors);
|
||||
}
|
||||
|
||||
|
@ -390,6 +400,11 @@ public class PutGCSObject extends AbstractGCSProcessor {
|
|||
blobWriteOptions.add(Storage.BlobWriteOption.encryptionKey(encryptionKey));
|
||||
}
|
||||
|
||||
final boolean gzipCompress = context.getProperty(GZIPCONTENT).asBoolean();
|
||||
if (!gzipCompress){
|
||||
blobWriteOptions.add(Storage.BlobWriteOption.disableGzipContent());
|
||||
}
|
||||
|
||||
final HashMap<String, String> userMetadata = new HashMap<>();
|
||||
for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
|
||||
if (entry.getKey().isDynamic()) {
|
||||
|
|
|
@ -180,7 +180,7 @@ public class PutGCSObjectTest extends AbstractGCSTest {
|
|||
runner.setProperty(PutGCSObject.ENCRYPTION_KEY, ENCRYPTION_KEY);
|
||||
runner.setProperty(PutGCSObject.OVERWRITE, String.valueOf(OVERWRITE));
|
||||
runner.setProperty(PutGCSObject.CONTENT_DISPOSITION_TYPE, CONTENT_DISPOSITION_TYPE);
|
||||
|
||||
runner.setProperty(PutGCSObject.GZIPCONTENT, Boolean.FALSE.toString());
|
||||
runner.assertValid();
|
||||
|
||||
when(storage.createFrom(blobInfoArgumentCaptor.capture(),
|
||||
|
|
Loading…
Reference in New Issue