use of com.netflix.spinnaker.front50.config.S3Config in project halyard by spinnaker.
the class S3Validator method validate.
@Override
public void validate(ConfigProblemSetBuilder ps, S3PersistentStore n) {
if (!StringUtils.isEmpty(n.getEndpoint())) {
return;
}
try {
AWSCredentialsProvider credentialsProvider = AwsAccountValidator.getAwsCredentialsProvider(n.getAccessKeyId(), n.getSecretAccessKey());
S3Config s3Config = new S3Config();
S3Properties s3Properties = new S3Properties();
s3Properties.setBucket(n.getBucket());
s3Properties.setRootFolder(n.getRootFolder());
s3Properties.setRegion(n.getRegion());
AmazonS3 s3Client = s3Config.awsS3Client(credentialsProvider, s3Properties);
new S3Config().s3StorageService(s3Client, s3Properties);
} catch (Exception e) {
ps.addProblem(Problem.Severity.ERROR, "Failed to ensure the required bucket \"" + n.getBucket() + "\" exists: " + e.getMessage());
}
}
Aggregations