mirror of
https://github.com/apache/nifi.git
synced 2025-02-28 14:39:10 +00:00
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
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src
main/java/org/apache/nifi/processors/gcp/storage
test/java/org/apache/nifi/processors/gcp/storage
@ -194,6 +194,15 @@ public class PutGCSObject extends AbstractGCSProcessor {
|
|||||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||||
.build();
|
.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(
|
public static final AllowableValue ACL_ALL_AUTHENTICATED_USERS = new AllowableValue(
|
||||||
ALL_AUTHENTICATED_USERS.name(), "All Authenticated Users", "Gives the bucket or object owner OWNER " +
|
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. " +
|
"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(ENCRYPTION_KEY);
|
||||||
descriptors.add(OVERWRITE);
|
descriptors.add(OVERWRITE);
|
||||||
descriptors.add(CONTENT_DISPOSITION_TYPE);
|
descriptors.add(CONTENT_DISPOSITION_TYPE);
|
||||||
|
descriptors.add(GZIPCONTENT);
|
||||||
return Collections.unmodifiableList(descriptors);
|
return Collections.unmodifiableList(descriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,6 +400,11 @@ public class PutGCSObject extends AbstractGCSProcessor {
|
|||||||
blobWriteOptions.add(Storage.BlobWriteOption.encryptionKey(encryptionKey));
|
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<>();
|
final HashMap<String, String> userMetadata = new HashMap<>();
|
||||||
for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
|
for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
|
||||||
if (entry.getKey().isDynamic()) {
|
if (entry.getKey().isDynamic()) {
|
||||||
|
@ -180,7 +180,7 @@ public class PutGCSObjectTest extends AbstractGCSTest {
|
|||||||
runner.setProperty(PutGCSObject.ENCRYPTION_KEY, ENCRYPTION_KEY);
|
runner.setProperty(PutGCSObject.ENCRYPTION_KEY, ENCRYPTION_KEY);
|
||||||
runner.setProperty(PutGCSObject.OVERWRITE, String.valueOf(OVERWRITE));
|
runner.setProperty(PutGCSObject.OVERWRITE, String.valueOf(OVERWRITE));
|
||||||
runner.setProperty(PutGCSObject.CONTENT_DISPOSITION_TYPE, CONTENT_DISPOSITION_TYPE);
|
runner.setProperty(PutGCSObject.CONTENT_DISPOSITION_TYPE, CONTENT_DISPOSITION_TYPE);
|
||||||
|
runner.setProperty(PutGCSObject.GZIPCONTENT, Boolean.FALSE.toString());
|
||||||
runner.assertValid();
|
runner.assertValid();
|
||||||
|
|
||||||
when(storage.createFrom(blobInfoArgumentCaptor.capture(),
|
when(storage.createFrom(blobInfoArgumentCaptor.capture(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user