@Inject public S3FileSystem( @Named("awss3roleassumption") IS3Credential cred, Provider<AbstractBackupPath> pathProvider, ICompression compress, final IConfiguration config, BackupMetrics backupMetrics, BackupNotificationMgr backupNotificationMgr, InstanceInfo instanceInfo) { super(pathProvider, compress, config, backupMetrics, backupNotificationMgr); s3Client = AmazonS3Client.builder() .withCredentials(cred.getAwsCredentialProvider()) .withRegion(instanceInfo.getRegion()) .build(); }
@Inject public S3EncryptedFileSystem( Provider<AbstractBackupPath> pathProvider, ICompression compress, final IConfiguration config, ICredential cred, @Named("filecryptoalgorithm") IFileCryptography fileCryptography, BackupMetrics backupMetrics, BackupNotificationMgr backupNotificationMgr, InstanceInfo instanceInfo) { super(pathProvider, compress, config, backupMetrics, backupNotificationMgr); this.encryptor = fileCryptography; super.s3Client = AmazonS3Client.builder() .withCredentials(cred.getAwsCredentialProvider()) .withRegion(instanceInfo.getRegion()) .build(); }
AmazonS3Client.builder() .withCredentials(s3Credential.getAwsCredentialProvider()) .withRegion(instanceInfo.getRegion())
RequestMetricCollector metricCollector = new PrestoS3FileSystemMetricCollector(stats); AWSCredentialsProvider awsCredentialsProvider = getAwsCredentialsProvider(config, defaults); AmazonS3Builder<? extends AmazonS3Builder, ? extends AmazonS3> clientBuilder = AmazonS3Client.builder() .withCredentials(awsCredentialsProvider) .withClientConfiguration(clientConfiguration)
clientBuilder = AmazonS3Client.builder() .withCredentials(credentialsProvider) .withClientConfiguration(clientConfig)
@Provides @LazySingleton public ServerSideEncryptingAmazonS3 getAmazonS3Client( AWSCredentialsProvider provider, AWSProxyConfig proxyConfig, AWSEndpointConfig endpointConfig, AWSClientConfig clientConfig, S3StorageConfig storageConfig ) { final ClientConfiguration configuration = new ClientConfigurationFactory().getConfig(); final Protocol protocol = determineProtocol(clientConfig, endpointConfig); final AmazonS3ClientBuilder builder = AmazonS3Client .builder() .withCredentials(provider) .withClientConfiguration(setProxyConfig(configuration, proxyConfig).withProtocol(protocol)) .withChunkedEncodingDisabled(clientConfig.isDisableChunkedEncoding()) .withPathStyleAccessEnabled(clientConfig.isEnablePathStyleAccess()) .withForceGlobalBucketAccessEnabled(clientConfig.isForceGlobalBucketAccessEnabled()); if (StringUtils.isNotEmpty(endpointConfig.getUrl())) { builder.setEndpointConfiguration( new EndpointConfiguration(endpointConfig.getUrl(), endpointConfig.getSigningRegion()) ); } return new ServerSideEncryptingAmazonS3(builder.build(), storageConfig.getServerSideEncryption()); }
public ProfileController(RateLimiters rateLimiters, AccountsManager accountsManager, ProfilesConfiguration profilesConfiguration) { AWSCredentials credentials = new BasicAWSCredentials(profilesConfiguration.getAccessKey(), profilesConfiguration.getAccessSecret()); AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); this.rateLimiters = rateLimiters; this.accountsManager = accountsManager; this.bucket = profilesConfiguration.getBucket(); this.s3client = AmazonS3Client.builder() .withCredentials(credentialsProvider) .withRegion(profilesConfiguration.getRegion()) .build(); this.policyGenerator = new PostPolicyGenerator(profilesConfiguration.getRegion(), profilesConfiguration.getBucket(), profilesConfiguration.getAccessKey()); this.policySigner = new PolicySigner(profilesConfiguration.getAccessSecret(), profilesConfiguration.getRegion()); }
private AmazonS3 getS3Client() { if (s3Client == null) { s3Client = config.getAwsClientFactory().create(AmazonS3Client.builder()); } return s3Client; }
/** * Creates a new S3 configuration cache. * @param bucket The S3 bucket. * @param prefix The S3 object prefix. * @param pathPattern The path pattern. * @param accessKey The (optional) S3 access key. * @param secretKey The (optional) S3 secret key. * @param region The AWS region (e.g. us-east-1). * @throws IOException Thrown if the configuration cannot be read. */ public S3ConfigurationCache(String bucket, String prefix, String pathPattern, String accessKey, String secretKey, String region) throws IOException { this.bucket = bucket; this.prefix = prefix; this.pathPattern = pathPattern; if (!StringUtils.isEmpty(accessKey)) { s3 = AmazonS3Client.builder() .withCredentials(new AWSStaticCredentialsProvider( new BasicAWSCredentials(accessKey, secretKey))) .withRegion(Regions.fromName(region)) .build(); } else { s3 = AmazonS3Client.builder() .withRegion(Regions.fromName(region)) .build(); } }
/** * Creates a new S3 configuration cache. * @param bucket The S3 bucket. * @param prefix The S3 object prefix. * @param pathPattern The path pattern. * @param accessKey The (optional) S3 access key. * @param secretKey The (optional) S3 secret key. * @param region The AWS region (e.g. us-east-1). * @throws IOException Thrown if the configuration cannot be read. */ public S3ConfigurationCache(String bucket, String prefix, String pathPattern, String accessKey, String secretKey, String region) throws IOException { this.bucket = bucket; this.prefix = prefix; this.pathPattern = pathPattern; if (!StringUtils.isEmpty(accessKey)) { s3 = AmazonS3Client.builder() .withCredentials(new AWSStaticCredentialsProvider( new BasicAWSCredentials(accessKey, secretKey))) .withRegion(Regions.fromName(region)) .build(); } else { s3 = AmazonS3Client.builder() .withRegion(Regions.fromName(region)) .build(); } }
public AmazonS3 buildS3(final URI uri, final String key, final String secret) { final Regions region = extractRegion(uri); return AmazonS3Client.builder() .withRegion(region) .withCredentials(new AWSStaticCredentialsProvider(credentials(key, secret))) .build(); }
RequestMetricCollector metricCollector = new PrestoS3FileSystemMetricCollector(stats); AWSCredentialsProvider awsCredentialsProvider = getAwsCredentialsProvider(config, defaults); AmazonS3Builder<? extends AmazonS3Builder, ? extends AmazonS3> clientBuilder = AmazonS3Client.builder() .withCredentials(awsCredentialsProvider) .withClientConfiguration(clientConfiguration)
clientBuilder = AmazonS3Client.builder() .withCredentials(credentialsProvider) .withClientConfiguration(clientConfig)
@Provides @LazySingleton public ServerSideEncryptingAmazonS3 getAmazonS3Client( AWSCredentialsProvider provider, AWSProxyConfig proxyConfig, AWSEndpointConfig endpointConfig, AWSClientConfig clientConfig, S3StorageConfig storageConfig ) { final ClientConfiguration configuration = new ClientConfigurationFactory().getConfig(); final AmazonS3ClientBuilder builder = AmazonS3Client .builder() .withCredentials(provider) .withClientConfiguration(setProxyConfig(configuration, proxyConfig)) .withChunkedEncodingDisabled(clientConfig.isDisableChunkedEncoding()) .withPathStyleAccessEnabled(clientConfig.isEnablePathStyleAccess()) .withForceGlobalBucketAccessEnabled(clientConfig.isForceGlobalBucketAccessEnabled()); if (StringUtils.isNotEmpty(endpointConfig.getUrl())) { builder.setEndpointConfiguration( new EndpointConfiguration(endpointConfig.getUrl(), endpointConfig.getSigningRegion()) ); } return new ServerSideEncryptingAmazonS3( builder.build(), storageConfig.getServerSideEncryption() ); }