Skip to content

Commit

Permalink
feat(experimentalIdentityAndAuth): copy smithy-typescript generic aut…
Browse files Browse the repository at this point in the history
…h tests
  • Loading branch information
Steven Yuan committed Sep 6, 2023
1 parent cd427f7 commit b92be17
Show file tree
Hide file tree
Showing 3 changed files with 134 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 @@ -36,6 +36,7 @@ plugins {

dependencies {
implementation("software.amazon.smithy:smithy-aws-protocol-tests:$smithyVersion")
implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
implementation(project(":smithy-aws-typescript-codegen"))
}

Expand Down
84 changes: 84 additions & 0 deletions codegen/generic-client-test-codegen/model/weather.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
$version: "2.0"

namespace example.weather

use aws.auth#sigv4

@authDefinition
@trait
structure customAuth {}

@trait
@protocolDefinition
structure fakeProtocol {}

@fakeProtocol
@httpApiKeyAuth(name: "X-Api-Key", in: "header")
@httpBearerAuth
@sigv4(name: "weather")
@customAuth
@auth([sigv4])
service Weather {
version: "2006-03-01"
operations: [
// experimentalIdentityAndAuth
OnlyHttpApiKeyAuth
OnlyHttpApiKeyAuthOptional
OnlyHttpBearerAuth
OnlyHttpBearerAuthOptional
OnlyHttpApiKeyAndBearerAuth
OnlyHttpApiKeyAndBearerAuthReversed
OnlySigv4Auth
OnlySigv4AuthOptional
OnlyCustomAuth
OnlyCustomAuthOptional
SameAsService
]
}

@http(method: "GET", uri: "/OnlyHttpApiKeyAuth")
@auth([httpApiKeyAuth])
operation OnlyHttpApiKeyAuth {}

@http(method: "GET", uri: "/OnlyHttpBearerAuth")
@auth([httpBearerAuth])
operation OnlyHttpBearerAuth {}

@http(method: "GET", uri: "/OnlySigv4Auth")
@auth([sigv4])
operation OnlySigv4Auth {}

@http(method: "GET", uri: "/OnlyHttpApiKeyAndBearerAuth")
@auth([httpApiKeyAuth, httpBearerAuth])
operation OnlyHttpApiKeyAndBearerAuth {}

@http(method: "GET", uri: "/OnlyHttpApiKeyAndBearerAuthReversed")
@auth([httpBearerAuth, httpApiKeyAuth])
operation OnlyHttpApiKeyAndBearerAuthReversed {}

@http(method: "GET", uri: "/OnlyHttpApiKeyAuthOptional")
@auth([httpApiKeyAuth])
@optionalAuth
operation OnlyHttpApiKeyAuthOptional {}

@http(method: "GET", uri: "/OnlyHttpBearerAuthOptional")
@auth([httpBearerAuth])
@optionalAuth
operation OnlyHttpBearerAuthOptional {}

@http(method: "GET", uri: "/OnlySigv4AuthOptional")
@auth([sigv4])
@optionalAuth
operation OnlySigv4AuthOptional {}

@http(method: "GET", uri: "/OnlyCustomAuth")
@auth([customAuth])
operation OnlyCustomAuth {}

@http(method: "GET", uri: "/OnlyCustomAuthOptional")
@auth([customAuth])
@optionalAuth
operation OnlyCustomAuthOptional {}

@http(method: "GET", uri: "/SameAsService")
operation SameAsService {}
49 changes: 49 additions & 0 deletions codegen/generic-client-test-codegen/smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,55 @@
"version": "1.0",
"imports": ["model/echo.smithy"],
"projections": {
"client-experimental-identity-and-auth": {
"transforms": [
{
"name": "includeServices",
"args": {
"services": ["example.weather#Weather"]
}
}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/weather",
"packageVersion": "0.0.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"private": true,
"experimentalIdentityAndAuth": true
}
}
},
"control-experimental-identity-and-auth": {
"transforms": [
{
"name": "includeServices",
"args": {
"services": ["example.weather#Weather"]
}
}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/weather",
"packageVersion": "0.0.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"private": true
}
}
},
"aws-echo-service": {
"transforms": [
{
Expand Down

0 comments on commit b92be17

Please sign in to comment.