NIFI-5850: Replaced custom AWS regions enum with the one from AWS Java SDK

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3190. This closes #3187.
This commit is contained in:
zenfenan 2018-11-29 14:59:23 +05:30 committed by Pierre Villard
parent 8a12307d1a
commit 7df537aeca
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
3 changed files with 2 additions and 61 deletions

View File

@ -53,7 +53,6 @@ import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.util.StandardValidators; import org.apache.nifi.processor.util.StandardValidators;
import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors; import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors;
import org.apache.nifi.processors.aws.regions.AWSRegions;
import org.apache.nifi.proxy.ProxyConfiguration; import org.apache.nifi.proxy.ProxyConfiguration;
import org.apache.nifi.proxy.ProxySpec; import org.apache.nifi.proxy.ProxySpec;
import org.apache.nifi.ssl.SSLContextService; import org.apache.nifi.ssl.SSLContextService;
@ -157,7 +156,7 @@ public abstract class AbstractAWSProcessor<ClientType extends AmazonWebServiceCl
public static final PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(true, PROXY_SPECS); public static final PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(true, PROXY_SPECS);
protected static AllowableValue createAllowableValue(final Regions region) { protected static AllowableValue createAllowableValue(final Regions region) {
return new AllowableValue(region.getName(), AWSRegions.getRegionDisplayName(region.getName())); return new AllowableValue(region.getName(), region.getDescription(), "AWS Region Code : " + region.getName());
} }
protected static AllowableValue[] getAvailableRegions() { protected static AllowableValue[] getAvailableRegions() {

View File

@ -1,58 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.processors.aws.regions;
public enum AWSRegions {
GovCloud("us-gov-west-1", "AWS GovCloud (US)"),
US_EAST_1("us-east-1", "US East (N. Virginia)"),
US_EAST_2("us-east-2", "US East (Ohio)"),
US_WEST_1("us-west-1", "US West (N. California)"),
US_WEST_2("us-west-2", "US West (Oregon)"),
EU_WEST_1("eu-west-1", "EU (Ireland)"),
EU_WEST_2("eu-west-2", "EU (London)"),
EU_WEST_3("eu-west-3", "EU (Paris)"),
EU_CENTRAL_1("eu-central-1", "EU (Frankfurt)"),
AP_SOUTH_1("ap-south-1", "Asia Pacific (Mumbai)"),
AP_SOUTHEAST_1("ap-southeast-1", "Asia Pacific (Singapore)"),
AP_SOUTHEAST_2("ap-southeast-2", "Asia Pacific (Sydney)"),
AP_NORTHEAST_1("ap-northeast-1", "Asia Pacific (Tokyo)"),
AP_NORTHEAST_2("ap-northeast-2", "Asia Pacific (Seoul)"),
SA_EAST_1("sa-east-1", "South America (Sao Paulo)"),
CN_NORTH_1("cn-north-1", "China (Beijing)"),
CN_NORTHWEST_1("cn-northwest-1", "China (Ningxia)"),
CA_CENTRAL_1("ca-central-1", "Canada (Central)");
private final String regionCode;
private final String regionDisplayName;
AWSRegions(String regionCode, String regionDisplayName) {
this.regionCode = regionCode;
this.regionDisplayName = regionDisplayName;
}
public static String getRegionDisplayName(String regionCode) {
for (AWSRegions regions : AWSRegions.values()) {
if (regions.regionCode.equalsIgnoreCase(regionCode)) {
return regions.regionDisplayName;
}
}
return regionCode;
}
}

View File

@ -26,7 +26,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<aws-java-sdk-version>1.11.412</aws-java-sdk-version> <aws-java-sdk-version>1.11.461</aws-java-sdk-version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>