From 03d6230982548f631350e8abac9954b59e8c7f28 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Tue, 12 Dec 2023 16:34:33 -0500 Subject: [PATCH] feat(experimentalIdentityAndAuth): add `endpointRuleSet` trait to generic client test (#5573) --- .../build.gradle.kts | 1 + .../model/weather.smithy | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/codegen/generic-client-test-codegen/build.gradle.kts b/codegen/generic-client-test-codegen/build.gradle.kts index da69f9602b98..8807dd1a9e7f 100644 --- a/codegen/generic-client-test-codegen/build.gradle.kts +++ b/codegen/generic-client-test-codegen/build.gradle.kts @@ -37,6 +37,7 @@ plugins { dependencies { implementation("software.amazon.smithy:smithy-aws-protocol-tests:$smithyVersion") implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion") + implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion") implementation(project(":smithy-aws-typescript-codegen")) } diff --git a/codegen/generic-client-test-codegen/model/weather.smithy b/codegen/generic-client-test-codegen/model/weather.smithy index 904af6edeed8..e06c10f1ffd4 100644 --- a/codegen/generic-client-test-codegen/model/weather.smithy +++ b/codegen/generic-client-test-codegen/model/weather.smithy @@ -3,6 +3,7 @@ $version: "2.0" namespace example.weather use aws.auth#sigv4 +use aws.api#service @authDefinition @trait @@ -12,6 +13,7 @@ structure customAuth {} @protocolDefinition structure fakeProtocol {} +@service(sdkId: "weather") @fakeProtocol @httpApiKeyAuth(name: "X-Api-Key", in: "header") @httpBearerAuth @@ -86,3 +88,30 @@ operation SameAsService { service: String } } + +apply Weather @smithy.rules#endpointRuleSet({ + "version": "1.3", + "parameters": { + "Region": { + "required": true, + "type": "String", + "documentation": "docs" + } + }, + "rules": [ + { + "conditions": [], + "documentation": "base rule", + "endpoint": { + "url": "https://{Region}.amazonaws.com", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ] +}) + +apply Weather @smithy.rules#clientContextParams( + Region: {type: "string", documentation: "docs"} +)