use of software.amazon.awssdk.services.acm.model.GetCertificateResponse in project data-prepper by opensearch-project.
the class ACMCertificateProvider method getCertificate.
public Certificate getCertificate() {
GetCertificateResponse getCertificateResponse = null;
long timeSlept = 0L;
while (getCertificateResponse == null && timeSlept < totalTimeout) {
try {
GetCertificateRequest getCertificateRequest = GetCertificateRequest.builder().certificateArn(acmArn).build();
getCertificateResponse = acmClient.getCertificate(getCertificateRequest);
} catch (final RequestInProgressException ex) {
try {
Thread.sleep(SLEEP_INTERVAL);
} catch (InterruptedException iex) {
throw new RuntimeException(iex);
}
} catch (final ResourceNotFoundException | InvalidArnException ex) {
LOG.error("Exception retrieving the certificate with arn: {}", acmArn, ex);
throw ex;
}
timeSlept += SLEEP_INTERVAL;
}
if (getCertificateResponse != null) {
return new Certificate(getCertificateResponse.certificate());
} else {
throw new IllegalStateException(String.format("Exception retrieving certificate results. Time spent retrieving certificate is %d ms and total time out set is %d ms.", timeSlept, totalTimeout));
}
}
Aggregations