Wait until a certificate is issued
Parameters:
-
certificate_authority_arn
(Arn)
–
The Amazon Resource Name (ARN) that was returned when you called CreateCertificateAuthority. This must be of the form:
arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 .
-
certificate_arn
(Arn)
–
The ARN of the issued certificate. The ARN contains the certificate serial number and must be in the following form:
arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012/certificate/286535153982981100925020015808220737245
-
max_wait_time
(float)
–
Maximum total seconds to wait before raising WaiterTimeoutError.
-
min_delay
(float, default:
1
)
–
Minimum seconds between operation attempts (spec default 2).
-
max_delay
(float, default:
60
)
–
Maximum seconds between operation attempts (spec default 120).
Source code in docs_src/capo_acm_pca/_services/async_acmpca.py
| async def wait_until_certificate_issued(
self,
certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
certificate_arn: "capo_acm_pca.types.arn.Arn",
*,
max_wait_time: float,
min_delay: float = 1,
max_delay: float = 60,
config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> "capo_acm_pca.types.get_certificate_response.GetCertificateResponse":
"""Wait until a certificate is issued
Args:
certificate_authority_arn: <p>The Amazon Resource Name (ARN) that was returned when you called <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_CreateCertificateAuthority.html">CreateCertificateAuthority</a>. This must be of the form: </p> <p> <code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>. </p>
certificate_arn: <p>The ARN of the issued certificate. The ARN contains the certificate serial number and must be in the following form: </p> <p> <code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i>/certificate/<i>286535153982981100925020015808220737245</i> </code> </p>
max_wait_time: Maximum total seconds to wait before raising WaiterTimeoutError.
min_delay: Minimum seconds between operation attempts (spec default 2).
max_delay: Maximum seconds between operation attempts (spec default 120).
"""
start = time.monotonic()
attempt = 0
while True:
op_output: "capo_acm_pca.types.get_certificate_response.GetCertificateResponse | None" = None
op_error: ServiceError | None = None
try:
op_output = await self.get_certificate( # noqa: F841
certificate_authority_arn,
certificate_arn,
config_overrides=config_overrides,
)
except ServiceError as e:
op_error = e
if op_output is not None:
return op_output
elif op_error is not None and op_error.code == "RequestInProgressException":
pass
elif op_error is not None and op_error.code == "AccessDeniedException":
raise WaiterFailedError(
"certificate_issued",
"errorType=AccessDeniedException (state=failure)",
)
elif op_error is not None:
raise op_error
elapsed = time.monotonic() - start
remaining = max_wait_time - elapsed
if remaining <= 0:
raise WaiterTimeoutError("certificate_issued", max_wait_time)
delay = min(max_delay, min_delay * (2**attempt))
delay = random.uniform(min_delay, delay)
delay = min(delay, remaining)
await anysleep(delay)
attempt += 1
|