client.setEndpoint(endpoint); } else if (!region.isEmpty()) { client.setRegion(Region.getRegion(Regions.fromName(region)));
s3.setEndpoint(bucketEndpoint);
s3Client.setEndpoint(configuration.getS3Endpoint().get());
AmazonS3 s3Client = new AmazonS3Client(credentials); s3Client.setEndpoint("http://s3-us-west-1.amazonaws.com");
/** * Create AmazonS3 client using AWS credentials * @return AmazonS3 */ protected AmazonS3 createClient() { AmazonS3 client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretAccessKey)); if (endPoint != null) { client.setEndpoint(endPoint); } return client; }
/** * Create AmazonS3 client using AWS credentials * @return AmazonS3 */ protected AmazonS3 createClient() { AmazonS3 client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretAccessKey)); if (endPoint != null) { client.setEndpoint(endPoint); } return client; }
/** * Create AmazonS3 client using AWS credentials * @return AmazonS3 */ protected AmazonS3 createClient() { AmazonS3 client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretAccessKey)); if (endPoint != null) { client.setEndpoint(endPoint); } return client; }
@Override public void setEndpoint(String endpoint) { getDelegate().setEndpoint(endpoint); }
private static AmazonS3 createS3ClientForEndpoint(String endPoint, AWSCredentialsProvider credentialsProvider, @Nullable ClientConfiguration s3Config) { AmazonS3 s3; if (s3Config == null) { s3 = new AmazonS3Client(credentialsProvider); } else { s3 = new AmazonS3Client(credentialsProvider, s3Config); } s3.setEndpoint(endPoint); return s3; }
private static AmazonS3 createS3ClientForEndpoint(String endPoint, AWSCredentialsProvider credentialsProvider, @Nullable ClientConfiguration s3Config) { AmazonS3 s3; if (s3Config == null) { s3 = new AmazonS3Client(credentialsProvider); } else { s3 = new AmazonS3Client(credentialsProvider, s3Config); } s3.setEndpoint(endPoint); return s3; }
@Override public void buildProcess(ProcessInstance instance, ResourceResolver rr) throws LoginException, RepositoryException { if (StringUtils.isNotBlank(s3BasePath) && !s3BasePath.endsWith("/")) { s3BasePath = s3BasePath + "/"; } instance.getInfo().setDescription(baseItemName + "->" + jcrBasePath); instance.defineCriticalAction("Create Folders", rr, this::createFolders); instance.defineCriticalAction("Import Assets", rr, this::importAssets); s3Client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey)); if (StringUtils.isNotBlank(endpointUrl)) { s3Client.setEndpoint(endpointUrl); } }
public static AmazonS3 s3client(Map<String, String> config) { // Use default credentials provider that looks in Env + Java properties + profile + instance role AmazonS3 s3Client = new AmazonS3Client(); // If worker config sets explicit endpoint override (e.g. for testing) use that String s3Endpoint = config.get("s3.endpoint"); if (s3Endpoint != null && !Objects.equals(s3Endpoint, "")) { s3Client.setEndpoint(s3Endpoint); } Boolean s3PathStyle = Boolean.parseBoolean(config.get("s3.path_style")); if (s3PathStyle) { s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); } return s3Client; }
public BeanstalkDeployer(String s3Endpoint, String beanstalkEndpoint, AWSCredentialsProvider credentialsProvider) { s3 = new AmazonS3Client(credentialsProvider); elasticBeanstalk = new AWSElasticBeanstalkClient(credentialsProvider); s3.setEndpoint(s3Endpoint); elasticBeanstalk.setEndpoint(beanstalkEndpoint); }
public BeanstalkDeployer(String s3Endpoint, String beanstalkEndpoint, AWSCredentialsProvider credentialsProvider) { s3 = new AmazonS3Client(credentialsProvider); elasticBeanstalk = new AWSElasticBeanstalkClient(credentialsProvider); s3.setEndpoint(s3Endpoint); elasticBeanstalk.setEndpoint(beanstalkEndpoint); }
@Override public void start() { // Set up Amazon S3 client. AWSCredentials credentials = new BasicAWSCredentials( awsAccessKeyId, awsSecretKey); ClientConfiguration config = new ClientConfiguration(); config.setProtocol(Protocol.HTTP); connection = new AmazonS3Client(credentials, config); connection.setEndpoint(endPoint); if (!connection.doesBucketExist(bucket)) { connection.createBucket(bucket); } super.start(); }
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.HTTP); AmazonS3 conn = new AmazonS3Client(credentials, clientConfig); conn.setEndpoint("correct end point"); Bucket bucket = conn.createBucket(bucketName); ObjectListing objects = conn.listObjects(bucket.getName()); do { for (S3ObjectSummary objectSummary : objects.getObjectSummaries()) { System.out.println(objectSummary.getKey() + "\t" + objectSummary.getSize() + "\t" + StringUtils.fromDate(objectSummary.getLastModified())); } objects = conn.listNextBatchOfObjects(objects); } while (objects.isTruncated());
private void detectEndpointFromBucket() { String location = this.amazonS3.getBucketLocation(this.bucketName); try { Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName)); this.amazonS3.setEndpoint(region.getEndpoint()); } catch (IllegalArgumentException e) { this.amazonS3.setRegion(parseRegion(location)); } }
public AmazonS3 getS3client() { BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, securityKey); if (testing && (!testingUrl.isEmpty() || !testingUrl.equals(""))) { s3client = new AmazonS3Client(awsCreds); s3client.setRegion(Region.getRegion(Regions.fromName(bucketRegion))); s3client.setEndpoint(testingUrl); s3client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()); } else { s3client = AmazonS3ClientBuilder.standard().withRegion(Regions.fromName(bucketRegion)) .withCredentials(new AWSStaticCredentialsProvider(awsCreds)).build(); } return s3client; }
@Override protected void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider) throws AuthenticationException { if (this.amazonS3 == null) { AuthenticationInfoAWSCredentialsProviderChain credentialsProvider = new AuthenticationInfoAWSCredentialsProviderChain(authenticationInfo); ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(proxyInfoProvider); this.bucketName = S3Utils.getBucketName(repository); this.baseDirectory = S3Utils.getBaseDirectory(repository); this.amazonS3 = new AmazonS3Client(credentialsProvider, clientConfiguration); Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName)); this.amazonS3.setEndpoint(region.getEndpoint()); } }
@Override protected void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider) throws AuthenticationException { if (this.amazonS3 == null) { ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(proxyInfoProvider); this.bucketName = S3Utils.getBucketName(repository); this.baseDirectory = S3Utils.getBaseDirectory(repository); this.amazonS3 = new AmazonS3Client(new DefaultAWSCredentialsProviderChain(), clientConfiguration); Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName)); this.amazonS3.setEndpoint(region.getEndpoint()); } }