use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project acs-aem-commons by Adobe-Consulting-Services.
the class S3AssetIngestor method buildProcess.
@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);
}
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project simplejpa by appoxy.
the class EntityManagerFactoryImpl method createClients.
private void createClients() {
AWSCredentials awsCredentials = null;
InputStream credentialsFile = getClass().getClassLoader().getResourceAsStream("AwsCredentials.properties");
if (credentialsFile != null) {
logger.info("Loading credentials from AwsCredentials.properties");
try {
awsCredentials = new PropertiesCredentials(credentialsFile);
} catch (IOException e) {
throw new PersistenceException("Failed loading credentials from AwsCredentials.properties.", e);
}
} else {
logger.info("Loading credentials from simplejpa.properties");
String awsAccessKey = (String) this.props.get(AWSACCESS_KEY_PROP_NAME);
String awsSecretKey = (String) this.props.get(AWSSECRET_KEY_PROP_NAME);
if (awsAccessKey == null || awsAccessKey.length() == 0) {
throw new PersistenceException("AWS Access Key not found. It is a required property.");
}
if (awsSecretKey == null || awsSecretKey.length() == 0) {
throw new PersistenceException("AWS Secret Key not found. It is a required property.");
}
awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
}
this.simpleDbClient = new AmazonSimpleDBClient(awsCredentials, createConfiguration(sdbSecure));
this.simpleDbClient.setEndpoint(sdbEndpoint);
this.s3Client = new AmazonS3Client(awsCredentials, createConfiguration(s3Secure));
this.s3Client.setEndpoint(s3Endpoint);
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project archaius by Netflix.
the class S3ConfigurationSourceTest method setup.
@Before
public void setup() throws Exception {
fakeS3 = createHttpServer();
client = new AmazonS3Client(new StaticCredentialsProvider(new AnonymousAWSCredentials()));
client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
client.setEndpoint("http://localhost:8069");
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project ice by Netflix.
the class AwsUtils method downloadFileIfChangedSince.
public static boolean downloadFileIfChangedSince(String bucketName, String bucketFilePrefix, File file, long milles, String accountId, String assumeRole, String externalId) {
AmazonS3Client s3Client = AwsUtils.s3Client;
try {
if (!StringUtils.isEmpty(accountId) && !StringUtils.isEmpty(assumeRole)) {
Credentials assumedCredentials = getAssumedCredentials(accountId, assumeRole, externalId);
s3Client = new AmazonS3Client(new BasicSessionCredentials(assumedCredentials.getAccessKeyId(), assumedCredentials.getSecretAccessKey(), assumedCredentials.getSessionToken()), clientConfig);
}
ObjectMetadata metadata = s3Client.getObjectMetadata(bucketName, bucketFilePrefix + file.getName());
boolean download = !file.exists() || metadata.getLastModified().getTime() > milles;
if (download) {
return download(s3Client, bucketName, bucketFilePrefix + file.getName(), file);
} else
return download;
} finally {
if (s3Client != AwsUtils.s3Client)
s3Client.shutdown();
}
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project ice by Netflix.
the class AwsUtils method init.
/**
* This method must be called before all methods can be used.
* @param credentialsProvider
*/
public static void init(AWSCredentialsProvider credentialsProvider) {
awsCredentialsProvider = credentialsProvider;
clientConfig = new ClientConfiguration();
String proxyHost = System.getProperty("https.proxyHost");
String proxyPort = System.getProperty("https.proxyPort");
if (proxyHost != null && proxyPort != null) {
clientConfig.setProxyHost(proxyHost);
clientConfig.setProxyPort(Integer.parseInt(proxyPort));
}
s3Client = new AmazonS3Client(awsCredentialsProvider, clientConfig);
securityClient = new AWSSecurityTokenServiceClient(awsCredentialsProvider, clientConfig);
if (System.getProperty("EC2_REGION") != null && !"us-east-1".equals(System.getProperty("EC2_REGION"))) {
if ("global".equals(System.getProperty("EC2_REGION"))) {
s3Client.setEndpoint("s3.amazonaws.com");
} else {
s3Client.setEndpoint("s3-" + System.getProperty("EC2_REGION") + ".amazonaws.com");
}
}
}
Aggregations