Search in sources :

Example 1 with S3Config

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());
    }
}
Also used : S3Config(com.netflix.spinnaker.front50.config.S3Config) AmazonS3(com.amazonaws.services.s3.AmazonS3) S3Properties(com.netflix.spinnaker.front50.config.S3Properties) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider)

Aggregations

AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)1 AmazonS3 (com.amazonaws.services.s3.AmazonS3)1 S3Config (com.netflix.spinnaker.front50.config.S3Config)1 S3Properties (com.netflix.spinnaker.front50.config.S3Properties)1