Expand description
Records what happened during one call to a generated client.
A handle is a value that records one call. You keep the handle, add it to a Capture with
Capture::with, and attach the Capture to the call as an interceptor. The Capture holds
a clone of the handle, and clones share one record, so the handle you kept reads what the call
reported. In this release the only handle is ChecksumCapture, which records whether the
response body was validated against its checksum.
use aws_smithy_observability::unit_of_work::checksums::{ChecksumCapture, ChecksumOutcome};
use aws_smithy_observability::unit_of_work::Capture;
let checksum = ChecksumCapture::new();
let capture = Capture::new().with(&checksum);
// Attach `capture` to one call with `.customize().interceptor(capture)`, send the call, and
// read the response body to its end. Then:
match checksum.try_outcome() {
Some(ChecksumOutcome::Validated { algorithm, .. }) => {
println!("validated with {}", algorithm.as_str())
}
Some(ChecksumOutcome::Mismatch { .. }) => println!("the body does not match its checksum"),
Some(other) => println!("not validated: {other:?}"),
None => println!("the call or its body has not ended"),
}Modules§
- checksums
- Records whether a call’s response body was validated against its checksum.
Structs§
- Capture
- Carries handles into one call to a generated client.