use of com.amazon.dataprepper.plugins.prepper.peerforwarder.certificate.file.FileCertificateProvider in project data-prepper by opensearch-project.
the class CertificateProviderFactory method getCertificateProvider.
public CertificateProvider getCertificateProvider() {
// ACM Cert for SSL takes preference
if (certificateProviderConfig.useAcmCertForSSL()) {
LOG.info("Using ACM certificate for SSL/TLS to setup trust store.");
final AwsCredentialsProvider credentialsProvider = AwsCredentialsProviderChain.builder().addCredentialsProvider(DefaultCredentialsProvider.create()).build();
final ClientOverrideConfiguration clientConfig = ClientOverrideConfiguration.builder().retryPolicy(RetryMode.STANDARD).build();
final AcmClient awsCertificateManager = AcmClient.builder().region(Region.of(certificateProviderConfig.getAwsRegion())).credentialsProvider(credentialsProvider).overrideConfiguration(clientConfig).build();
return new ACMCertificateProvider(awsCertificateManager, certificateProviderConfig.getAcmCertificateArn(), certificateProviderConfig.getAcmCertIssueTimeOutMillis());
} else if (certificateProviderConfig.isSslCertFileInS3()) {
LOG.info("Using S3 to fetch certificate for SSL/TLS to setup trust store.");
final AwsCredentialsProvider credentialsProvider = AwsCredentialsProviderChain.builder().addCredentialsProvider(DefaultCredentialsProvider.create()).build();
final S3Client s3Client = S3Client.builder().region(Region.of(certificateProviderConfig.getAwsRegion())).credentialsProvider(credentialsProvider).build();
return new S3CertificateProvider(s3Client, certificateProviderConfig.getSslKeyCertChainFile());
} else {
LOG.info("Using local file system to get certificate for SSL/TLS to setup trust store.");
return new FileCertificateProvider(certificateProviderConfig.getSslKeyCertChainFile());
}
}
Aggregations