Skip to content

wait_until_stream_group_deleted

wait_until_stream_group_deleted(
    identifier: Identifier,
    *,
    max_wait_time: float,
    min_delay: float = 30,
    max_delay: float = 1800,
    config_overrides: Optional[GameLiftStreamsClientConfig] = None,
) -> ServiceError

Waits until a stream group is deleted

Parameters:

  • identifier (Identifier) –

    An Amazon Resource Name (ARN) or ID that uniquely identifies the stream group resource. Example ARN: arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4. Example ID: sg-1AB2C3De4.

  • max_wait_time (float) –

    Maximum total seconds to wait before raising WaiterTimeoutError.

  • min_delay (float, default: 30 ) –

    Minimum seconds between operation attempts (spec default 2).

  • max_delay (float, default: 1800 ) –

    Maximum seconds between operation attempts (spec default 120).

Source code in docs_src/capo_gameliftstreams/_services/game_lift_streams.py
def wait_until_stream_group_deleted(
    self,
    identifier: "capo_gameliftstreams.types.identifier.Identifier",
    *,
    max_wait_time: float,
    min_delay: float = 30,
    max_delay: float = 1800,
    config_overrides: Optional[GameLiftStreamsClientConfig] = None,
) -> ServiceError:
    """Waits until a stream group is deleted

    Args:
        identifier: <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</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_gameliftstreams.types.get_stream_group_output.GetStreamGroupOutput | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = self.get_stream_group(  # noqa: F841
                identifier, config_overrides=config_overrides
            )
        except ServiceError as e:
            op_error = e
        if op_error is not None and op_error.code == "ResourceNotFoundException":
            return op_error
        elif op_error is not None:
            raise op_error

        elapsed = time.monotonic() - start
        remaining = max_wait_time - elapsed
        if remaining <= 0:
            raise WaiterTimeoutError("stream_group_deleted", 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