Skip to content

Commit

Permalink
feat(experimentalIdentityAndAuth): add endpointRuleSet trait to gen…
Browse files Browse the repository at this point in the history
…eric client test (#5573)
  • Loading branch information
Steven Yuan authored Dec 12, 2023
1 parent cdcbe7a commit 03d6230
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions codegen/generic-client-test-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

Expand Down
29 changes: 29 additions & 0 deletions codegen/generic-client-test-codegen/model/weather.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $version: "2.0"
namespace example.weather

use aws.auth#sigv4
use aws.api#service

@authDefinition
@trait
Expand All @@ -12,6 +13,7 @@ structure customAuth {}
@protocolDefinition
structure fakeProtocol {}

@service(sdkId: "weather")
@fakeProtocol
@httpApiKeyAuth(name: "X-Api-Key", in: "header")
@httpBearerAuth
Expand Down Expand Up @@ -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"}
)

0 comments on commit 03d6230

Please sign in to comment.