Skip to content

wait_until_certificate_authority_csr_created async

wait_until_certificate_authority_csr_created(
    certificate_authority_arn: Arn,
    *,
    max_wait_time: float,
    min_delay: float = 3,
    max_delay: float = 180,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> GetCertificateAuthorityCsrResponse

Wait until a Certificate Authority CSR is created

Parameters:

  • certificate_authority_arn (Arn) –

    The Amazon Resource Name (ARN) that was returned when you called the CreateCertificateAuthority action. This must be of the form:

    arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012

  • max_wait_time (float) –

    Maximum total seconds to wait before raising WaiterTimeoutError.

  • min_delay (float, default: 3 ) –

    Minimum seconds between operation attempts (spec default 2).

  • max_delay (float, default: 180 ) –

    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_authority_csr_created(
    self,
    certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
    *,
    max_wait_time: float,
    min_delay: float = 3,
    max_delay: float = 180,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> "capo_acm_pca.types.get_certificate_authority_csr_response.GetCertificateAuthorityCsrResponse":
    """Wait until a Certificate Authority CSR is created

    Args:
        certificate_authority_arn: <p>The Amazon Resource Name (ARN) that was returned when you called the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_CreateCertificateAuthority.html">CreateCertificateAuthority</a> action. 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>
        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_authority_csr_response.GetCertificateAuthorityCsrResponse | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = await self.get_certificate_authority_csr(  # noqa: F841
                certificate_authority_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_authority_csr_created",
                "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_authority_csr_created", 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