Wait for asset_not_exists.
Parameters:
-
asset_id
(CustomID)
–
The ID of the asset. This can be either the actual ID in UUID format, or else externalId: followed by the external ID, if it has one. For more information, see Referencing objects with external IDs in the IoT SiteWise User Guide.
-
max_wait_time
(float)
–
Maximum total seconds to wait before raising WaiterTimeoutError.
-
min_delay
(float, default:
3
)
–
Minimum seconds between operation attempts (spec default 2).
-
max_delay
(float, default:
120
)
–
Maximum seconds between operation attempts (spec default 120).
-
exclude_properties
(Optional[ExcludeProperties], default:
None
)
–
Whether or not to exclude asset properties from the response.
Source code in docs_src/capo_iotsitewise/_services/async_io_t_site_wise.py
| async def wait_until_asset_not_exists(
self,
asset_id: "capo_iotsitewise.types.custom_id.CustomID",
*,
max_wait_time: float,
min_delay: float = 3,
max_delay: float = 120,
config_overrides: Optional[AsyncIoTSiteWiseClientConfig] = None,
exclude_properties: Optional[
"capo_iotsitewise.types.exclude_properties.ExcludeProperties"
] = None,
) -> ServiceError:
"""Wait for asset_not_exists.
Args:
asset_id: <p>The ID of the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</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).
exclude_properties: <p> Whether or not to exclude asset properties from the response. </p>
"""
start = time.monotonic()
attempt = 0
while True:
op_output: "capo_iotsitewise.types.describe_asset_response.DescribeAssetResponse | None" = None
op_error: ServiceError | None = None
try:
op_output = await self.describe_asset( # noqa: F841
asset_id,
config_overrides=config_overrides,
exclude_properties=exclude_properties,
)
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("asset_not_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
|