pub fn require_valid_identifier(
member: &str,
identifier: &str,
) -> Result<(), Error>Expand description
Rejects a MicrovmIdentifier/MicrovmImageIdentifier the service would reject.
§Twelve members across every implemented operation
Both shapes are min: 1, max: 256, and between them they bound the identifier on
GetMicrovm, SuspendMicrovm, ResumeMicrovm, TerminateMicrovm,
CreateMicrovmAuthToken, GetMicrovmImage, DeleteMicrovmImage,
DeleteMicrovmImageVersion, GetMicrovmImageVersion, UpdateMicrovmImageVersion,
GetMicrovmImageBuild, the three listings, and RunMicrovm.imageIdentifier. Issue #24
counted six implemented operations for each shape; every one of them is guarded here.
§An empty identifier is the case that pays for this
Ten of those members are URI parameters, and an empty one does not produce a validation
error about a blank field: it collapses the path. GET /2025-09-09/microvms/ addresses the
listing, not a VM, so an empty id sent to get_microvm asks a different question and can
get a 200 back for it — and DELETE on a collapsed path is worse. That failure mode is
invisible in the service’s answer, which is the strongest argument for a local refusal
anywhere in this module.
§The model contradicts itself, and this is the side that can be guarded
MicrovmImageArn permits 2048 and is what the service answers with, so the model allows a
legal response value that is an illegal request value — see
crate::constants::MAX_IDENTIFIER_LEN for the whole account. The message says so, because
a caller who hit it by echoing an ARN back is looking at a service inconsistency rather than
at their own mistake, and telling them “shorten it” would be useless advice about a value
they did not choose.