List of usage examples for com.amazonaws.services.kms AWSKMSClient getServiceName
public String getServiceName()
From source file:com.cloudera.director.aws.ec2.EC2Provider.java
License:Apache License
/** * Returns the KMS endpoint URL for the specified region. * * @param kmsClient the KMS client/*from w ww.j a va 2 s .com*/ * @param regionName the desired region * @return the endpoint URL for the specified region * @throws IllegalArgumentException if the endpoint cannot be determined */ private static String getKMSEndpointForRegion(AWSKMSClient kmsClient, String regionName) { checkNotNull(kmsClient, "kmsClient is null"); checkNotNull(regionName, "regionName is null"); com.amazonaws.regions.Region region = RegionUtils.getRegion(regionName); if (region == null) { throw new IllegalArgumentException(String.format("Unable to find the region %s", regionName)); } String serviceName = kmsClient.getServiceName(); String protocolPrefix = region.hasHttpsEndpoint(serviceName) ? "https://" : "http://"; return protocolPrefix + region.getServiceEndpoint(serviceName); }