Unverified Commit 3c11815e authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Merge 0.56.x back into main (#3003)



## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->

## Description
<!--- Describe your changes in detail -->

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: default avatarysaito1001 <awsaito@amazon.com>
Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>
Co-authored-by: default avatarkstich <kevin@kstich.com>
parent 07c993d8
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -843,10 +843,23 @@ mod tests {
        );
    }

    fn valid_input(input: &Vec<String>) -> bool {
        [
            "content-length".to_owned(),
            "content-type".to_owned(),
            "host".to_owned(),
        ]
        .iter()
        .all(|element| !input.contains(&element))
    }

    proptest! {
        #[test]
        fn presigning_header_exclusion_with_explicit_exclusion_list_specified(
           excluded_headers in prop::collection::vec("[a-z]{1,20}", 1..10),
            excluded_headers in prop::collection::vec("[a-z]{1,20}", 1..10).prop_filter(
                "`excluded_headers` should pass the `valid_input` check",
                valid_input,
            )
        ) {
            let mut request_builder = http::Request::builder()
                .uri("https://some-endpoint.some-region.amazonaws.com")
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ apply BackplaneControlService @endpointRuleSet({
                  "endpoint": { "url": "https://www.example.com" }
              }],
    "parameters": {
        "Bucket": { "required": false, "type": "String" },
        "Region": { "required": false, "type": "String", "builtIn": "AWS::Region" },
    }
})
+20 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ use smithy.rules#endpointTests
                    "authSchemes": [{
                                        "name": "sigv4",
                                        "signingRegion": "{Region}",
                                        "signingName": "blah"
                                    }]
                }
            }
@@ -33,6 +34,24 @@ use smithy.rules#endpointTests
    ]
})
@endpointTests({"version": "1", "testCases": [
    {
        "documentation": "region set",
        "expect": {
            "endpoint": {
                "url": "https://prod.us-east-1.api.myservice.aws.dev",
                "properties": {
                    "authSchemes": [{
                                        "name": "sigv4",
                                        "signingRegion": "us-east-1",
                                        "signingName": "blah"
                                    }]

                }
            }
        },
        "params": { "Region": "us-east-1" }
        "operationInputs": [ ]
    },
    {
        "documentation": "region should fallback to the default",
        "expect": {
@@ -42,6 +61,7 @@ use smithy.rules#endpointTests
                    "authSchemes": [{
                                        "name": "sigv4",
                                        "signingRegion": "us-east-2",
                                        "signingName": "blah"
                                    }]

                }
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ dependencies {
    implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
    implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion")
    implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion")
    implementation("software.amazon.smithy:smithy-aws-endpoints:$smithyVersion")
}

val generateAwsRuntimeCrateVersion by tasks.registering {
+8 −7
Original line number Diff line number Diff line
@@ -11,8 +11,9 @@ import software.amazon.smithy.model.node.Node
import software.amazon.smithy.model.node.StringNode
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.model.shapes.ShapeId
import software.amazon.smithy.rulesengine.aws.language.functions.AwsBuiltIns
import software.amazon.smithy.rulesengine.language.EndpointRuleSet
import software.amazon.smithy.rulesengine.language.syntax.parameters.Builtins
import software.amazon.smithy.rulesengine.language.syntax.parameters.BuiltIns
import software.amazon.smithy.rulesengine.language.syntax.parameters.Parameter
import software.amazon.smithy.rulesengine.language.syntax.parameters.ParameterType
import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext
@@ -57,9 +58,9 @@ fun ClientCodegenContext.getBuiltIn(builtIn: String): Parameter? {
}

private fun promotedBuiltins(parameter: Parameter) =
    parameter.builtIn == Builtins.FIPS.builtIn ||
        parameter.builtIn == Builtins.DUALSTACK.builtIn ||
        parameter.builtIn == Builtins.SDK_ENDPOINT.builtIn
    parameter.builtIn == AwsBuiltIns.FIPS.builtIn ||
        parameter.builtIn == AwsBuiltIns.DUALSTACK.builtIn ||
        parameter.builtIn == BuiltIns.SDK_ENDPOINT.builtIn

private fun configParamNewtype(parameter: Parameter, name: String, runtimeConfig: RuntimeConfig): RuntimeType {
    val type = parameter.symbol().mapRustType { t -> t.stripOuter<RustType.Option>() }
@@ -195,10 +196,10 @@ fun Node.toWritable(): Writable {

val PromotedBuiltInsDecorators =
    listOf(
        decoratorForBuiltIn(Builtins.FIPS),
        decoratorForBuiltIn(Builtins.DUALSTACK),
        decoratorForBuiltIn(AwsBuiltIns.FIPS),
        decoratorForBuiltIn(AwsBuiltIns.DUALSTACK),
        decoratorForBuiltIn(
            Builtins.SDK_ENDPOINT,
            BuiltIns.SDK_ENDPOINT,
            ConfigParam.Builder()
                .name("endpoint_url")
                .type(RuntimeType.String.toSymbol())
Loading