Skip to content

Commit

Permalink
Merge branch 'main' into tyop
Browse files Browse the repository at this point in the history
  • Loading branch information
Velfi authored Sep 24, 2024
2 parents 02eb684 + 6b42eb5 commit f223b24
Show file tree
Hide file tree
Showing 25 changed files with 730 additions and 266 deletions.
10 changes: 10 additions & 0 deletions .changelog/1725553080.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
applies_to: ["client", "aws-sdk-rust"]
authors: ["Velfi"]
references: ["smithy-rs#3820"]
breaking: false
new_feature: false
bug_fix: true
---

Fixed a bug with the content length of compressed payloads that caused such requests to hang.
11 changes: 0 additions & 11 deletions .changelog/1725892046.md

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<!-- Do not manually edit this file. Use the `changelogger` tool. -->
September 17th, 2024
====================

September 9th, 2024
===================
**Breaking Changes:**
Expand Down
79 changes: 45 additions & 34 deletions aws/SDK_CHANGELOG.next.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,6 @@
{
"smithy-rs": [],
"aws-sdk-rust": [
{
"message": "Allow [AwsUserAgent](https://docs.rs/aws-runtime/1.3.1/aws_runtime/user_agent/struct.AwsUserAgent.html) to incorporate business metrics, which now deprecates the existing feature and config metadata.\n",
"meta": {
"bug": false,
"breaking": false,
"tada": false
},
"author": "ysaito1001",
"references": [
"smithy-rs#3781"
],
"since-commit": "433e1a00e2d3eadfde78b472d78b30a8f9204dbe",
"age": 5
},
{
"message": "Fix incorrect redaction of `@sensitive` types in maps and lists.\n",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "landonxjames",
"references": [
"smithy-rs#3765",
"smithy-rs#3757"
],
"since-commit": "433e1a00e2d3eadfde78b472d78b30a8f9204dbe",
"age": 5
},
{
"message": "Upgrade MSRV to Rust 1.78.0.\n",
"meta": {
Expand All @@ -46,7 +17,7 @@
"smithy-rs#3800"
],
"since-commit": "d64aea29ad48d7bddb5a7511f3f1175c478e2c1e",
"age": 2
"age": 3
},
{
"message": "Add minimal support for `AWS::Auth::AccountId` and `AWS::Auth::AccountIdEndpointMode` endpoint built-ins\n",
Expand All @@ -60,7 +31,7 @@
"smithy-rs#3792"
],
"since-commit": "d64aea29ad48d7bddb5a7511f3f1175c478e2c1e",
"age": 2
"age": 3
},
{
"message": "Fix the execution order of [modify_before_serialization](https://docs.rs/aws-smithy-runtime-api/latest/aws_smithy_runtime_api/client/interceptors/trait.Intercept.html#method.modify_before_serialization) and [read_before_serialization](https://docs.rs/aws-smithy-runtime-api/latest/aws_smithy_runtime_api/client/interceptors/trait.Intercept.html#method.read_before_serialization) in the orchestrator. The `modify_before_serialization` method now executes before the `read_before_serialization` method. This adjustment may result in changes in behavior depending on how you customize interceptors.\n",
Expand All @@ -74,7 +45,7 @@
"smithy-rs#3798"
],
"since-commit": "d64aea29ad48d7bddb5a7511f3f1175c478e2c1e",
"age": 2
"age": 3
},
{
"message": "Fix the [Length::UpTo](https://docs.rs/aws-smithy-types/1.2.2/aws_smithy_types/byte_stream/enum.Length.html) usage in [FsBuilder](https://docs.rs/aws-smithy-types/1.2.2/aws_smithy_types/byte_stream/struct.FsBuilder.html), ensuring that the specified length does not exceed the remaining file length.\n",
Expand All @@ -89,7 +60,7 @@
"smithy-rs#3797"
],
"since-commit": "d64aea29ad48d7bddb5a7511f3f1175c478e2c1e",
"age": 2
"age": 3
},
{
"message": "Re-export `ByteStream`'s `Length` and `FsBuilder`. By making these types available directly within a client crate, customers can use `ByteStream::read_from` without needing to import them separately from the `aws-smithy-types` crate.\n",
Expand All @@ -103,7 +74,47 @@
"aws-sdk-rust#820"
],
"since-commit": "d64aea29ad48d7bddb5a7511f3f1175c478e2c1e",
"age": 2
"age": 3
},
{
"message": "Remove stalled stream protection from transcribe-streaming operations.\n",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "landonxjames",
"references": [
"aws-sdk-rust#1181"
],
"since-commit": "c622e5e97b199cc2382a4fbc14a9773e9ea1766c",
"age": 1
},
{
"message": "deprecate http-02x presign APIs in favor of http-1x equivalents\n",
"meta": {
"bug": false,
"breaking": false,
"tada": false
},
"author": "aajtodd",
"references": [],
"since-commit": "c622e5e97b199cc2382a4fbc14a9773e9ea1766c",
"age": 1
},
{
"message": "Update Smoketest codegeneration to be endpoint built-in aware.\n",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "landonxjames",
"references": [
"smithy-rs#3836"
],
"since-commit": "c622e5e97b199cc2382a4fbc14a9773e9ea1766c",
"age": 1
}
],
"aws-sdk-model": []
Expand Down
10 changes: 5 additions & 5 deletions aws/rust-runtime/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions aws/rust-runtime/aws-config/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-config"
version = "1.5.6"
version = "1.5.7"
authors = [
"AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
"Russell Cohen <rcoh@amazon.com>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import software.amazon.smithy.rustsdk.customize.s3control.S3ControlDecorator
import software.amazon.smithy.rustsdk.customize.sso.SSODecorator
import software.amazon.smithy.rustsdk.customize.sts.STSDecorator
import software.amazon.smithy.rustsdk.customize.timestream.TimestreamDecorator
import software.amazon.smithy.rustsdk.customize.transcribestreaming.TranscribeStreamingDecorator
import software.amazon.smithy.rustsdk.endpoints.AwsEndpointsStdLib
import software.amazon.smithy.rustsdk.endpoints.OperationInputTestDecorator
import software.amazon.smithy.rustsdk.endpoints.RequireEndpointRules
Expand Down Expand Up @@ -88,6 +89,7 @@ val DECORATORS: List<ClientCodegenDecorator> =
SSODecorator().onlyApplyTo("com.amazonaws.sso#SWBPortalService"),
TimestreamDecorator().onlyApplyTo("com.amazonaws.timestreamwrite#Timestream_20181101"),
TimestreamDecorator().onlyApplyTo("com.amazonaws.timestreamquery#Timestream_20181101"),
TranscribeStreamingDecorator().onlyApplyTo("com.amazonaws.transcribestreaming#Transcribe"),
// Only build docs-rs for linux to reduce load on docs.rs
listOf(
DocsRsMetadataDecorator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import software.amazon.smithy.model.node.ObjectNode
import software.amazon.smithy.model.shapes.MemberShape
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.StructureShape
import software.amazon.smithy.rulesengine.language.syntax.parameters.Parameters
import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext
import software.amazon.smithy.rust.codegen.client.smithy.customize.ClientCodegenDecorator
import software.amazon.smithy.rust.codegen.client.smithy.endpoint.EndpointRulesetIndex
import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator
import software.amazon.smithy.rust.codegen.core.rustlang.Attribute
import software.amazon.smithy.rust.codegen.core.rustlang.Attribute.Companion.cfg
Expand Down Expand Up @@ -42,6 +44,7 @@ import software.amazon.smithy.smoketests.traits.SmokeTestCase
import software.amazon.smithy.smoketests.traits.SmokeTestsTrait
import java.util.Optional
import java.util.logging.Logger
import kotlin.jvm.optionals.getOrElse

class SmokeTestsDecorator : ClientCodegenDecorator {
override val name: String = "SmokeTests"
Expand Down Expand Up @@ -134,7 +137,7 @@ fun renderPrologue(
they are disabled by default. To enable them, run the tests with
```sh
RUSTFLAGS="--cfg smoketests" cargo test.
RUSTFLAGS="--cfg smoketests" cargo test
```
""",
)
Expand Down Expand Up @@ -168,6 +171,19 @@ class SmokeTestsInstantiator(
private val model = codegenContext.model
private val symbolProvider = codegenContext.symbolProvider

// Get list of the built-ins actually included in the model
private val builtInParamNames: List<String> by lazy {
val index = EndpointRulesetIndex.of(codegenContext.model)
val rulesOrNull = index.endpointRulesForService(codegenContext.serviceShape)
val builtInParams: Parameters = (rulesOrNull?.parameters ?: Parameters.builder().build())
val temp: MutableList<String> = mutableListOf()
builtInParams.forEach { temp.add(it.builtIn.getOrElse { "" }) }
temp
}
private val fipsName = "AWS::UseFIPS"
private val dualStackName = "AWS::UseDualStack"
private val rc = codegenContext.runtimeConfig

fun render(
writer: RustWriter,
testCase: SmokeTestCase,
Expand All @@ -191,9 +207,20 @@ class SmokeTestsInstantiator(

val vendorParams = AwsSmokeTestModel.getAwsVendorParams(testCase)
vendorParams.orNull()?.let { params ->
rust(".region(config::Region::new(${params.region.dq()}))")
rust(".use_dual_stack(${params.useDualstack()})")
rust(".use_fips(${params.useFips()})")
rustTemplate(
".region(#{Region}::new(${params.region.dq()}))",
"Region" to AwsRuntimeType.awsTypes(rc).resolve("region::Region"),
)

// The `use_dual_stack` and `use_fips` fields will only exist on the endpoint params if they built-ins are
// included in the model, so we check for that before setting them.
if (builtInParamNames.contains(dualStackName)) {
rust(".use_dual_stack(${params.useDualstack()})")
}
if (builtInParamNames.contains(fipsName)) {
rust(".use_fips(${params.useFips()})")
}

params.uri.orNull()?.let { rust(".endpoint_url($it)") }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.rustsdk.customize.transcribestreaming

import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.model.shapes.ShapeId
import software.amazon.smithy.model.transform.ModelTransformer
import software.amazon.smithy.rust.codegen.client.smithy.ClientRustSettings
import software.amazon.smithy.rust.codegen.client.smithy.customize.ClientCodegenDecorator
import software.amazon.smithy.rust.codegen.client.smithy.traits.IncompatibleWithStalledStreamProtectionTrait
import software.amazon.smithy.rust.codegen.core.util.letIf
import java.util.logging.Logger

/**
* Top level decorator for TranscribeStreaming
*/
class TranscribeStreamingDecorator : ClientCodegenDecorator {
private val operationsIncompatibleWithStalledStreamProtection =
setOf(
ShapeId.from("com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscription"),
ShapeId.from("com.amazonaws.transcribestreaming#StartMedicalStreamTranscription"),
ShapeId.from("com.amazonaws.transcribestreaming#StartStreamTranscription"),
)

override val name: String = "TranscribeStreamingDecorator"
override val order: Byte = 0
private val logger = Logger.getLogger(javaClass.name)

override fun transformModel(
service: ServiceShape,
model: Model,
settings: ClientRustSettings,
): Model =
ModelTransformer.create().mapShapes(model) { shape ->
shape.letIf(shape.id in operationsIncompatibleWithStalledStreamProtection) {
logger.info("Adding IncompatibleWithStalledStreamProtection trait to $it")
(it as OperationShape).toBuilder().addTrait(IncompatibleWithStalledStreamProtectionTrait()).build()
}
}
}
Loading

0 comments on commit f223b24

Please sign in to comment.