August 8th, 2022
Pre-release
Pre-release
·
2048 commits
to main
since this release
Breaking Changes:
- ⚠ (smithy-rs#1157) Rename EventStreamInput to EventStreamSender
- ⚠ (smithy-rs#1157) The type of streaming unions that contain errors is generated without those errors.
Errors in a streaming unionUnionare generated as members of the typeUnionError.
Taking Transcribe as an example, theAudioStreamstreaming union generates, in the client, both theAudioStreamtype:and its error type,pub enum AudioStream { AudioEvent(crate::model::AudioEvent), Unknown, }
pub struct AudioStreamError { /// Kind of error that occurred. pub kind: AudioStreamErrorKind, /// Additional metadata about the error, including error code, message, and request ID. pub(crate) meta: aws_smithy_types::Error, }
AudioStreamErrorKindcontains all error variants for the union.
Before, the generated code looked as:pub enum AudioStream { AudioEvent(crate::model::AudioEvent), ... all error variants, Unknown, }
- ⚠ (smithy-rs#1157)
aws_smithy_http::event_stream::EventStreamSenderandaws_smithy_http::event_stream::Receiverare now generic over<T, E>,
whereTis a streaming union andEthe union's errors.
This means that event stream errors are now sent asErrof the union's error type.
With this example model:Before:@streaming union Event { throttlingError: ThrottlingError } @error("client") structure ThrottlingError {}
After:stream! { yield Ok(Event::ThrottlingError ...) }
An example from the SDK is in transcribe streaming.stream! { yield Err(EventError::ThrottlingError ...) }
New this release:
-
🎉 (smithy-rs#1482) The AWS SDK for Rust now supports additional checksum algorithms for Amazon S3.
When getting and putting objects, you may now request that the request body be validated with a checksum. The supported
algorithms are SHA-1, SHA-256, CRC-32, and CRC-32C.#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let sdk_config = aws_config::load_from_env().await; let s3_client = aws_sdk_s3::Client::new(&sdk_config); let body = aws_sdk_s3::types::ByteStream::read_from() .path(std::path::Path::new("./path/to/your/file.txt")) .build() .await .unwrap(); let _ = s3_client .put_object() .bucket("your-bucket") .key("file.txt") .body(body) // When using this field, the checksum will be calculated for you .checksum_algorithm(aws_sdk_s3::model::ChecksumAlgorithm::Crc32C) .send() .await?; let body = aws_sdk_s3::types::ByteStream::read_from() .path(std::path::Path::new("./path/to/your/other-file.txt")) .build() .await .unwrap(); let _ = s3_client .put_object() .bucket("your-bucket") .key("other-file.txt") .body(body) // Alternatively, you can pass a checksum that you've calculated yourself. It must be base64 // encoded. Also, make sure that you're base64 encoding the bytes of the checksum, not its // string representation. .checksum_crc32_c(aws_smithy_types::base64::encode(&A_PRECALCULATED_CRC_32_C_CHECKSUM[..])) .send() .await?; }
-
🎉 (smithy-rs#1571, smithy-rs#1385) SDK crate READMEs now include an example of creating a client
-
(smithy-rs#1573, smithy-rs#1569) Non-streaming struct members are now marked
#[doc(hidden)]since they will be removed in the future