public DefaultAwsRegionProviderChain() { super(new AwsEnvVarOverrideRegionProvider(), new AwsSystemPropertyRegionProvider(), new AwsProfileRegionProvider(), new InstanceMetadataRegionProvider()); } }
/** * Returns the region with the given regionName and proper partition if found in region metadata. * Otherwise, returns a {@link Region} object with given regionName and aws partition. */ public static Region getRegion(String regionName) { return getRegionMetadata().getRegion(regionName); }
/** * Returns a list of the available AWS regions. */ public static List<Region> getRegions() { return getRegionMetadata().getRegions(); }
/** * Returns the region configured for the default AWS SDK metric collector; * or null if the default is to be used. * * @throws IllegalArgumentException when using a region not included in * {@link Regions} * * @deprecated Use {@link #getRegionName()} */ public static Regions getRegion() throws IllegalArgumentException { return Regions.fromName(region.getName()); }
private String resolveCertCommonName(String region) { if (Regions.CN_NORTH_1.getName().equals(region)) { return "sns-cn-north-1.amazonaws.com.cn"; } if (Regions.CN_NORTHWEST_1.getName().equals(region)) { return "sns-cn-northwest-1.amazonaws.com.cn"; } if (Regions.GovCloud.getName().equals(region)) { return "sns-us-gov-west-1.amazonaws.com"; } return "sns." + RegionUtils.getRegion(region).getDomain(); } }
/** * Returns the region name configured for the default AWS SDK metric collector; * or null if the default is to be used. */ public static String getRegionName() { return region == null ? null : region.getName(); }
/** * Parses the specified input stream and returns a {@code RegionMetadata} * object. * * @param input the input stream to parse * @return the parsed region metadata * @throws IOException on error */ public static RegionMetadata parse(final InputStream input) throws IOException { return new RegionMetadata(internalParse(input, false)); }
/** * Creates an {@link SnsMessageManager} using the AWS region obtained from the environment. See * <a href="http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html">Region Selection</a> * for more information. */ public SnsMessageManager() { this(new DefaultAwsRegionProviderChain().getRegion()); }
public static RegionMetadata create() { RegionMetadata metadata = createLegacyXmlRegionMetadata(); if (metadata == null) { metadata = new RegionMetadata(new PartitionsLoader().build()); } return metadata; }
/** * Returns a list of the regions that support the service given. * * @param serviceAbbreviation * The service endpoint prefix which can be retrieved from the * constant ENDPOINT_PREFIX of the specific service client interface. * */ public static List<Region> getRegionsForService( String serviceAbbreviation) { return getRegionMetadata().getRegionsForService(serviceAbbreviation); }
/** * Returns the partition this region is in. I.E. 'aws' or 'aws-cn' * * @return The partition this region is in. */ public String getPartition() { return regionImpl.getPartition(); }
/** * Returns whether the given service support the https protocol in this region. * * @param serviceName * The service endpoint prefix which can be retrieved from the * constant ENDPOINT_PREFIX of the specific service client interface, * e.g. AmazonEC2.ENDPOINT_PREFIX. */ public boolean hasHttpsEndpoint(String serviceName) { return regionImpl.hasHttpsEndpoint(serviceName); }
/** * Loads a set of region metadata from an arbitrary {@code InputStream} * containing an XML file. * * @param stream the stream to load from * @return the loaded region metadata * @throws IOException on error reading from the stream */ public static RegionMetadata load (final InputStream stream) throws IOException { return RegionMetadataParser.parse(stream); }
/** * The unique system ID for this region; ex: "us-east-1". * * @return The unique system ID for this region. */ public String getName() { return regionImpl.getName(); }
/** * Returns whether the given service is supported in this region. * * @param serviceName * The service endpoint prefix which can be retrieved from the * constant ENDPOINT_PREFIX of the specific service client interface, * e.g. AmazonEC2.ENDPOINT_PREFIX. */ public boolean isServiceSupported(String serviceName) { return regionImpl.isServiceSupported(serviceName); }
/** * Returns an immutable list of all regions known to this region metadata * object, in no particular order. * * @return an immutable list of all regions */ public List<Region> getRegions() { return provider.getRegions(); }
/** * Returns the region with the name given, if it exists. Otherwise, returns * null. * * @param name the name of the region to search for * @return the corresponding region, if it exists */ public Region getRegion(final String name) { return provider.getRegion(name); }
/** * Returns a immutable collection of all endpoints available in the * metadata. */ public Collection<String> getAvailableEndpoints() { return regionImpl.getAvailableEndpoints(); }