mirror of https://github.com/apache/nifi.git
NIFI-13251 Replaced deprecated AWS method Region.fromName()
This closes #8848 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
24b13d7a3e
commit
2e7e3733f3
|
@ -23,7 +23,7 @@ import com.amazonaws.auth.AWSCredentialsProvider;
|
|||
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||
import com.amazonaws.http.conn.ssl.SdkTLSSocketFactory;
|
||||
import com.amazonaws.regions.Region;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.amazonaws.regions.RegionUtils;
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
|
||||
|
@ -306,7 +306,7 @@ public abstract class AbstractAWSCredentialsProviderProcessor<ClientType extends
|
|||
if (getSupportedPropertyDescriptors().contains(REGION)) {
|
||||
final String regionValue = context.getProperty(REGION).getValue();
|
||||
if (regionValue != null) {
|
||||
return Region.getRegion(Regions.fromName(regionValue));
|
||||
return RegionUtils.getRegion(regionValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.nifi.processors.aws.util;
|
||||
|
||||
import com.amazonaws.regions.Region;
|
||||
import com.amazonaws.regions.RegionUtils;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.nifi.components.AllowableValue;
|
||||
|
@ -84,7 +85,7 @@ public final class RegionUtilV1 {
|
|||
}
|
||||
|
||||
try {
|
||||
return Region.getRegion(Regions.fromName(regionValue));
|
||||
return RegionUtils.getRegion(regionValue);
|
||||
} catch (Exception e) {
|
||||
throw new ProcessException(String.format("The [%s] attribute contains an invalid region value [%s]", S3_REGION_ATTRIBUTE, regionValue), e);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.aws.s3.encryption;
|
||||
|
||||
import com.amazonaws.regions.Region;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.amazonaws.regions.RegionUtils;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3Builder;
|
||||
import com.amazonaws.services.s3.AmazonS3EncryptionClientV2;
|
||||
|
@ -50,7 +49,7 @@ public class ClientSideKMSEncryptionStrategy implements S3EncryptionStrategy {
|
|||
|
||||
final CryptoConfigurationV2 cryptoConfig = new CryptoConfigurationV2();
|
||||
if (StringUtils.isNotBlank(kmsRegion)) {
|
||||
cryptoConfig.setAwsKmsRegion(Region.getRegion(Regions.fromName(kmsRegion)));
|
||||
cryptoConfig.setAwsKmsRegion(RegionUtils.getRegion(kmsRegion));
|
||||
}
|
||||
|
||||
final AmazonS3EncryptionClientV2Builder builder = AmazonS3EncryptionClientV2.encryptionBuilder()
|
||||
|
|
Loading…
Reference in New Issue