/** * 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 SpinnakerAwsRegionProvider() { super( new Ec2RegionEnvVarRegionProvider(), new DefaultAwsRegionProviderChain(), new RegionsCurrentRegionProvider(), new DefaultRegionProvider() ); }
/** * Constructor * @param config - Configuration map */ public S3Helper(Map<String, Object> config) { AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard(); if(config.containsKey(ACCESS_KEY_ID_CONFIG) && config.containsKey(SECRET_KEY_CONFIG)) { builder.withCredentials( new AWSStaticCredentialsProvider( new BasicAWSCredentials( config.get(ACCESS_KEY_ID_CONFIG).toString(), config.get(SECRET_KEY_CONFIG).toString()))); } else { builder.withCredentials(DefaultAWSCredentialsProviderChain.getInstance()); } if(config.containsKey(REGION_CONFIG)) { builder.withRegion(config.get(REGION_CONFIG).toString()); } else { AwsRegionProvider regionProvider = new DefaultAwsRegionProviderChain(); builder.withRegion(regionProvider.getRegion()); } s3 = builder.build(); exceptionOnError = (boolean) config.getOrDefault(EXCEPTION_ON_ERROR_CONFIG, EXCEPTION_ON_ERROR_DEFAULT); }
final String region = new DefaultAwsRegionProviderChain().getRegion(); final EndpointConfiguration endpointConfig = new EndpointConfiguration(endpoint, region);
return new DefaultAwsRegionProviderChain(); } else {
public static PutObjectResult putObject(String containerName, String filePath, InputStream body) throws IOException { final String endpoint = getContainerEndpoint(containerName); if (endpoint == null || endpoint.isEmpty()) { System.err.println("Could not determine container endpoint!"); System.exit(1); } final String region = new DefaultAwsRegionProviderChain().getRegion(); final EndpointConfiguration endpointConfig = new EndpointConfiguration(endpoint, region); final AWSMediaStoreData mediastoredata = AWSMediaStoreDataClientBuilder .standard() .withEndpointConfiguration(endpointConfig) .build(); final PutObjectRequest request = new PutObjectRequest() .withContentType("application/octet-stream") .withBody(body) .withPath(filePath); try { return mediastoredata.putObject(request); } catch (AWSMediaStoreException e) { System.err.println(e.getErrorMessage()); System.exit(1); } return null; }
public AWSAuthentication() { signer = new AWS4Signer(false); signer.setServiceName("es"); signer.setRegionName(new DefaultAwsRegionProviderChain().getRegion()); AWSCredentialsProvider credsProvider = new DefaultAWSCredentialsProviderChain(); credentials = credsProvider.getCredentials(); }
com.amazonaws.regions.Region region = parseRegion(new DefaultAwsRegionProviderChain().getRegion()); if (!region.getPartition().equals("aws")) { this.amazonS3.setRegion(region);