Skip to content

wait_until_instance_profile_exists

wait_until_instance_profile_exists(
    instance_profile_name: instanceProfileNameType,
    *,
    max_wait_time: float,
    min_delay: float = 1,
    max_delay: float = 120,
    config_overrides: Optional[IAMClientConfig] = None,
) -> GetInstanceProfileResponse

Wait for instance_profile_exists.

Parameters:

  • instance_profile_name (instanceProfileNameType) –

    The name of the instance profile to get information about.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

  • 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: 120 ) –

    Maximum seconds between operation attempts (spec default 120).

Source code in docs_src/capo_iam/_services/iam.py
def wait_until_instance_profile_exists(
    self,
    instance_profile_name: "capo_iam.types.instance_profile_name_type.instanceProfileNameType",
    *,
    max_wait_time: float,
    min_delay: float = 1,
    max_delay: float = 120,
    config_overrides: Optional[IAMClientConfig] = None,
) -> "capo_iam.types.get_instance_profile_response.GetInstanceProfileResponse":
    """Wait for instance_profile_exists.

    Args:
        instance_profile_name: <p>The name of the instance profile to get information about.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</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_iam.types.get_instance_profile_response.GetInstanceProfileResponse | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = self.get_instance_profile(  # noqa: F841
                instance_profile_name, 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 == "NoSuchEntityException":
            pass
        elif op_error is not None:
            raise op_error

        elapsed = time.monotonic() - start
        remaining = max_wait_time - elapsed
        if remaining <= 0:
            raise WaiterTimeoutError("instance_profile_exists", max_wait_time)
        delay = min(max_delay, min_delay * (2**attempt))
        delay = random.uniform(min_delay, delay)
        delay = min(delay, remaining)
        time.sleep(delay)
        attempt += 1