Wait for alarm_mute_rule_exists.
Parameters:
-
max_wait_time
(float)
–
Maximum total seconds to wait before raising WaiterTimeoutError.
-
min_delay
(float, default:
5
)
–
Minimum seconds between operation attempts (spec default 2).
-
max_delay
(float, default:
120
)
–
Maximum seconds between operation attempts (spec default 120).
-
alarm_mute_rule_name
(Optional[Name], default:
None
)
–
The name of the alarm mute rule to retrieve.
Source code in docs_src/capo_cloudwatch/_services/async_cloud_watch.py
| async def wait_until_alarm_mute_rule_exists(
self,
*,
max_wait_time: float,
min_delay: float = 5,
max_delay: float = 120,
config_overrides: Optional[AsyncCloudWatchClientConfig] = None,
alarm_mute_rule_name: Optional["capo_cloudwatch.types.name.Name"] = None,
) -> "capo_cloudwatch.types.get_alarm_mute_rule_output.GetAlarmMuteRuleOutput":
"""Wait for alarm_mute_rule_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).
alarm_mute_rule_name: <p>The name of the alarm mute rule to retrieve.</p>
"""
start = time.monotonic()
attempt = 0
while True:
op_output: "capo_cloudwatch.types.get_alarm_mute_rule_output.GetAlarmMuteRuleOutput | None" = None
op_error: ServiceError | None = None
try:
op_output = await self.get_alarm_mute_rule( # noqa: F841
config_overrides=config_overrides,
alarm_mute_rule_name=alarm_mute_rule_name,
)
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("alarm_mute_rule_exists", 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
|