List of usage examples for com.amazonaws.regions Region createClient
@Deprecated public <T extends AmazonWebServiceClient> T createClient(Class<T> serviceClass, AWSCredentialsProvider credentials, ClientConfiguration config)
From source file:br.com.ingenieux.jenkins.plugins.awsebdeployment.Deployer.java
License:Apache License
private void initAWS() { log("Creating S3 and AWSEB Client (AWS Access Key Id: %s, region: %s)", context.getAwsAccessKeyId(), context.getAwsRegion());/*from w w w . jav a2s . c o m*/ AWSCredentialsProvider credentials = new AWSCredentialsProviderChain(new StaticCredentialsProvider( new BasicAWSCredentials(context.getAwsAccessKeyId(), context.getAwsSecretSharedKey()))); Region region = Region.getRegion(Regions.fromName(context.getAwsRegion())); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setUserAgent("ingenieux CloudButler/" + getVersion()); s3 = region.createClient(AmazonS3Client.class, credentials, clientConfig); awseb = region.createClient(AWSElasticBeanstalkClient.class, credentials, clientConfig); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonElasticTranscoder transcodeClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonElasticTranscoderClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonS3 s3Client(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonS3Client.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonRDS rdsClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonRDSClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonDynamoDB dynamoClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonDynamoDBClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonCloudWatchAsyncClient cloudwatchClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonCloudWatchAsyncClient.class, creds, null); }
From source file:com.amediamanager.springconfig.ServerConfig.java
License:Apache License
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonSQS sqsClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonSQSClient.class, creds, null); }
From source file:com.nike.cerberus.module.CerberusModule.java
License:Apache License
private static <M extends AmazonWebServiceClient> M createAmazonClientInstance(Class<M> clientClass, Region region) { String cerberusRoleToAssume = System.getenv(CERBERUS_ASSUME_ROLE_ARN) != null ? System.getenv(CERBERUS_ASSUME_ROLE_ARN) : ""; String cerberusRoleToAssumeExternalId = System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID) != null ? System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID) : ""; STSAssumeRoleSessionCredentialsProvider sTSAssumeRoleSessionCredentialsProvider = new STSAssumeRoleSessionCredentialsProvider.Builder( cerberusRoleToAssume, UUID.randomUUID().toString()).withExternalId(cerberusRoleToAssumeExternalId) .build();// w ww . j av a2 s . c om AWSCredentialsProviderChain chain = new AWSCredentialsProviderChain( new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new ProfileCredentialsProvider(), sTSAssumeRoleSessionCredentialsProvider, new InstanceProfileCredentialsProvider()); return region.createClient(clientClass, chain, new ClientConfiguration()); }
From source file:com.smoketurner.pipeline.application.config.AwsConfiguration.java
License:Apache License
@JsonIgnore public AmazonS3Client buildS3(final Environment environment) { final Region region = Region.getRegion(this.region); Objects.requireNonNull(region); Preconditions.checkArgument(region.isServiceSupported("s3"), "S3 is not supported in " + region); final ClientConfiguration clientConfig = getClientConfiguration(); final AmazonS3Client s3 = region.createClient(AmazonS3Client.class, provider, clientConfig); environment.lifecycle().manage(new AmazonS3ClientManager(s3)); return s3;//from w ww .ja v a2 s.c o m }
From source file:com.smoketurner.pipeline.application.config.AwsConfiguration.java
License:Apache License
@JsonIgnore public AmazonSQSClient buildSQS(final Environment environment) { final Region region = Region.getRegion(this.region); Objects.requireNonNull(region); Preconditions.checkArgument(region.isServiceSupported("sqs"), "SQS is not supported in " + region); final ClientConfiguration clientConfig = getClientConfiguration(); final AmazonSQSClient sqs = region.createClient(AmazonSQSClient.class, provider, clientConfig); environment.lifecycle().manage(new AmazonSQSClientManager(sqs)); return sqs;/* w w w. ja v a2s . c o m*/ }