public Certificate getCertificate()

in data-prepper-plugins/peer-forwarder/src/main/java/com/amazon/dataprepper/plugins/prepper/peerforwarder/certificate/acm/ACMCertificateProvider.java [35:62]


    public Certificate getCertificate() {
        GetCertificateResult getCertificateResult = null;
        long timeSlept = 0L;

        while (getCertificateResult == null && timeSlept < totalTimeout) {
            try {
                final GetCertificateRequest getCertificateRequest = new GetCertificateRequest()
                        .withCertificateArn(acmArn);
                getCertificateResult = awsCertificateManager.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(getCertificateResult != null) {
            return new Certificate(getCertificateResult.getCertificate());
        } 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));
        }
    }