pub fn require_valid_version(member: &str, version: &str) -> Result<(), Error>Expand description
Rejects a Version/NonBlankString value the service would reject.
§Why this one is checked locally when so many are not
The model’s Version shape is min: 1, max: 2048, pattern: [^\s]+, and issue #24 lists
NonBlankString as its most-reused unguarded shape. Two of the three constraints are ones
botocore would not catch even if this client used it (max and pattern are outside
VALIDATED_METADATA_ATTRS), and this client uses aws-sigv4 plus reqwest and never
touches botocore’s validator at all.
What makes it worth a guard rather than a comment is where the two callers sit.
CreateMicrovmImage.baseImageVersion is sent after the artifact upload, so the
service’s rejection costs the caller the upload — the same argument
require_valid_image_name makes. And RunMicrovm.imageVersion is the pinned-launch
half of a rollback: a blank there is a ValidationException at the moment someone is
trying to re-pin away from a bad version, which is the worst possible time for the failure
to be about the request rather than about the version.
The pattern is [^\s]+ — no whitespace anywhere, not merely “not blank”. A version
copied out of a terminal with a trailing newline satisfies “non-empty” and fails the
pattern, so the message names the character rather than saying the value is invalid.