Wait for function_exists.
Parameters:
-
function_name
(NamespacedFunctionName)
–
The name or ARN of the Lambda function, version, or alias.
Name formats
-
Function name – my-function (name-only), my-function:v1 (with alias).
-
Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function.
-
Partial ARN – 123456789012:function:my-function.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
-
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:
20
)
–
Maximum seconds between operation attempts (spec default 120).
-
qualifier
(Optional[NumericLatestPublishedOrAliasQualifier], default:
None
)
–
Specify a version or alias to get details about a published version of the function.
Source code in docs_src/capo_lambda/_services/_lambda.py
| def wait_until_function_exists(
self,
function_name: "capo_lambda.types.namespaced_function_name.NamespacedFunctionName",
*,
max_wait_time: float,
min_delay: float = 1,
max_delay: float = 20,
config_overrides: Optional[LambdaClientConfig] = None,
qualifier: Optional[
"capo_lambda.types.numeric_latest_published_or_alias_qualifier.NumericLatestPublishedOrAliasQualifier"
] = None,
) -> "capo_lambda.types.get_function_response.GetFunctionResponse":
"""Wait for function_exists.
Args:
function_name: <p>The name or ARN of the Lambda function, version, or alias.</p> <p class="title"> <b>Name formats</b> </p> <ul> <li> <p> <b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p> </li> <li> <p> <b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p> </li> <li> <p> <b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p> </li> </ul> <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</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).
qualifier: <p>Specify a version or alias to get details about a published version of the function.</p>
"""
start = time.monotonic()
attempt = 0
while True:
op_output: "capo_lambda.types.get_function_response.GetFunctionResponse | None" = None
op_error: ServiceError | None = None
try:
op_output = self.get_function( # noqa: F841
function_name,
config_overrides=config_overrides,
qualifier=qualifier,
)
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 == "ResourceNotFoundException":
pass
elif op_error is not None:
raise op_error
elapsed = time.monotonic() - start
remaining = max_wait_time - elapsed
if remaining <= 0:
raise WaiterTimeoutError("function_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
|