Skip to content

wait_until_load_balancer_exists

wait_until_load_balancer_exists(
    *,
    max_wait_time: float,
    min_delay: float = 15,
    max_delay: float = 120,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    load_balancer_arns: Optional[LoadBalancerArns] = None,
    names: Optional[LoadBalancerNames] = None,
    marker: Optional[Marker] = None,
    page_size: Optional[PageSize] = None,
) -> DescribeLoadBalancersOutput

Wait for load_balancer_exists.

Parameters:

  • max_wait_time (float) –

    Maximum total seconds to wait before raising WaiterTimeoutError.

  • min_delay (float, default: 15 ) –

    Minimum seconds between operation attempts (spec default 2).

  • max_delay (float, default: 120 ) –

    Maximum seconds between operation attempts (spec default 120).

  • load_balancer_arns (Optional[LoadBalancerArns], default: None ) –

    The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.

  • names (Optional[LoadBalancerNames], default: None ) –

    The names of the load balancers.

  • marker (Optional[Marker], default: None ) –

    The marker for the next set of results. (You received this marker from a previous call.)

  • page_size (Optional[PageSize], default: None ) –

    The maximum number of results to return with this call.

Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
def wait_until_load_balancer_exists(
    self,
    *,
    max_wait_time: float,
    min_delay: float = 15,
    max_delay: float = 120,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    load_balancer_arns: Optional[
        "capo_elastic_load_balancing_v2.types.load_balancer_arns.LoadBalancerArns"
    ] = None,
    names: Optional[
        "capo_elastic_load_balancing_v2.types.load_balancer_names.LoadBalancerNames"
    ] = None,
    marker: Optional["capo_elastic_load_balancing_v2.types.marker.Marker"] = None,
    page_size: Optional[
        "capo_elastic_load_balancing_v2.types.page_size.PageSize"
    ] = None,
) -> "capo_elastic_load_balancing_v2.types.describe_load_balancers_output.DescribeLoadBalancersOutput":
    """Wait for load_balancer_exists.

    Args:
        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).
        load_balancer_arns: <p>The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.</p>
        names: <p>The names of the load balancers.</p>
        marker: <p>The marker for the next set of results. (You received this marker from a previous call.)</p>
        page_size: <p>The maximum number of results to return with this call.</p>
    """
    start = time.monotonic()
    attempt = 0
    while True:
        op_output: "capo_elastic_load_balancing_v2.types.describe_load_balancers_output.DescribeLoadBalancersOutput | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = self.describe_load_balancers(  # noqa: F841
                config_overrides=config_overrides,
                load_balancer_arns=load_balancer_arns,
                names=names,
                marker=marker,
                page_size=page_size,
            )
        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 == "LoadBalancerNotFound":
            pass
        elif op_error is not None:
            raise op_error

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