Skip to content

Commit 0a561ee

Browse files
authored
fix(codegen): pass through sha256 in non-AWS sigv4 generated client (#6415)
1 parent 0899e93 commit 0a561ee

File tree

39 files changed

+1009
-139
lines changed

39 files changed

+1009
-139
lines changed

codegen/generic-client-test-codegen/model/weather.smithy

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ $version: "2.0"
33
namespace example.weather
44

55
use aws.auth#sigv4
6+
use aws.protocols#restJson1
67

78
@authDefinition
89
@trait
910
structure customAuth {}
1011

11-
@trait
12-
@protocolDefinition
13-
structure fakeProtocol {}
14-
15-
@fakeProtocol
12+
@restJson1
1613
@httpApiKeyAuth(name: "X-Api-Key", in: "header")
1714
@httpBearerAuth
1815
@sigv4(name: "weather")

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/SupportSigV4Auth.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public Optional<HttpAuthScheme> getHttpAuthScheme() {
130130
*/
131131
signingProperties: {
132132
context,
133+
sha256: (config as any).sha256,
133134
},
134135
};
135136
},"""))

private/aws-protocoltests-ec2/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-json-10/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-json-machinelearning/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-json/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-query/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-restjson-apigateway/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const partitionHash: PartitionHash = {
6767
"ap-southeast-2",
6868
"ap-southeast-3",
6969
"ap-southeast-4",
70+
"ap-southeast-5",
7071
"ca-central-1",
7172
"ca-west-1",
7273
"eu-central-1",

private/aws-protocoltests-restjson-glacier/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const partitionHash: PartitionHash = {
7575
"ap-southeast-2",
7676
"ap-southeast-3",
7777
"ap-southeast-4",
78+
"ap-southeast-5",
7879
"ca-central-1",
7980
"ca-west-1",
8081
"eu-central-1",

private/aws-protocoltests-restjson/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",

private/aws-protocoltests-restxml/src/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const partitionHash: PartitionHash = {
1818
"ap-southeast-2",
1919
"ap-southeast-3",
2020
"ap-southeast-4",
21+
"ap-southeast-5",
2122
"ca-central-1",
2223
"ca-west-1",
2324
"eu-central-1",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Weather } from "@aws-sdk/weather";
2+
3+
import { requireRequestsFrom } from "../requests/test-http-handler";
4+
5+
describe(Weather.name, () => {
6+
it("should be able to make a request without errors", async () => {
7+
const client = new Weather({
8+
credentials: {
9+
accessKeyId: "",
10+
secretAccessKey: "",
11+
},
12+
endpoint: "https://localhost",
13+
});
14+
15+
requireRequestsFrom(client).toMatch({
16+
body: /./,
17+
});
18+
19+
await client.onlySigv4Auth({});
20+
21+
expect.hasAssertions();
22+
});
23+
});

private/weather-legacy-auth/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@aws-crypto/sha256-js": "5.2.0",
2121
"@aws-sdk/client-sso-oidc": "*",
2222
"@aws-sdk/client-sts": "*",
23+
"@aws-sdk/core": "*",
2324
"@aws-sdk/credential-provider-node": "*",
2425
"@aws-sdk/middleware-host-header": "*",
2526
"@aws-sdk/middleware-logger": "*",
@@ -32,6 +33,7 @@
3233
"@aws-sdk/util-user-agent-browser": "*",
3334
"@aws-sdk/util-user-agent-node": "*",
3435
"@smithy/config-resolver": "^3.0.5",
36+
"@smithy/core": "^2.4.0",
3537
"@smithy/fetch-http-handler": "^3.2.4",
3638
"@smithy/hash-node": "^3.0.3",
3739
"@smithy/invalid-dependency": "^3.0.3",
@@ -53,11 +55,13 @@
5355
"@smithy/util-middleware": "^3.0.3",
5456
"@smithy/util-retry": "^3.0.3",
5557
"@smithy/util-utf8": "^3.0.0",
56-
"tslib": "^2.6.2"
58+
"tslib": "^2.6.2",
59+
"uuid": "^9.0.1"
5760
},
5861
"devDependencies": {
5962
"@tsconfig/node16": "16.1.3",
6063
"@types/node": "^16.18.96",
64+
"@types/uuid": "^9.0.4",
6165
"concurrently": "7.0.0",
6266
"downlevel-dts": "0.10.1",
6367
"rimraf": "3.0.2",

private/weather-legacy-auth/src/commands/OnlyCustomAuthCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlyCustomAuthCommand, se_OnlyCustomAuthCommand } from "../protocols/Aws_restJson1";
34
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
45
import { getSerdePlugin } from "@smithy/middleware-serde";
56
import { Command as $Command } from "@smithy/smithy-client";
@@ -63,10 +64,6 @@ export class OnlyCustomAuthCommand extends $Command
6364
.s("Weather", "OnlyCustomAuth", {})
6465
.n("WeatherClient", "OnlyCustomAuthCommand")
6566
.f(void 0, void 0)
66-
.ser(() => {
67-
throw new Error("No supported protocol was found");
68-
})
69-
.de(() => {
70-
throw new Error("No supported protocol was found");
71-
})
67+
.ser(se_OnlyCustomAuthCommand)
68+
.de(de_OnlyCustomAuthCommand)
7269
.build() {}

private/weather-legacy-auth/src/commands/OnlyCustomAuthOptionalCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlyCustomAuthOptionalCommand, se_OnlyCustomAuthOptionalCommand } from "../protocols/Aws_restJson1";
34
import { getSerdePlugin } from "@smithy/middleware-serde";
45
import { Command as $Command } from "@smithy/smithy-client";
56
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
@@ -62,10 +63,6 @@ export class OnlyCustomAuthOptionalCommand extends $Command
6263
.s("Weather", "OnlyCustomAuthOptional", {})
6364
.n("WeatherClient", "OnlyCustomAuthOptionalCommand")
6465
.f(void 0, void 0)
65-
.ser(() => {
66-
throw new Error("No supported protocol was found");
67-
})
68-
.de(() => {
69-
throw new Error("No supported protocol was found");
70-
})
66+
.ser(se_OnlyCustomAuthOptionalCommand)
67+
.de(de_OnlyCustomAuthOptionalCommand)
7168
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpApiKeyAndBearerAuthCommand.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
33
import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth";
4+
import {
5+
de_OnlyHttpApiKeyAndBearerAuthCommand,
6+
se_OnlyHttpApiKeyAndBearerAuthCommand,
7+
} from "../protocols/Aws_restJson1";
48
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
59
import { getSerdePlugin } from "@smithy/middleware-serde";
610
import { Command as $Command } from "@smithy/smithy-client";
@@ -71,10 +75,6 @@ export class OnlyHttpApiKeyAndBearerAuthCommand extends $Command
7175
.s("Weather", "OnlyHttpApiKeyAndBearerAuth", {})
7276
.n("WeatherClient", "OnlyHttpApiKeyAndBearerAuthCommand")
7377
.f(void 0, void 0)
74-
.ser(() => {
75-
throw new Error("No supported protocol was found");
76-
})
77-
.de(() => {
78-
throw new Error("No supported protocol was found");
79-
})
78+
.ser(se_OnlyHttpApiKeyAndBearerAuthCommand)
79+
.de(de_OnlyHttpApiKeyAndBearerAuthCommand)
8080
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpApiKeyAndBearerAuthReversedCommand.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
33
import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth";
4+
import {
5+
de_OnlyHttpApiKeyAndBearerAuthReversedCommand,
6+
se_OnlyHttpApiKeyAndBearerAuthReversedCommand,
7+
} from "../protocols/Aws_restJson1";
48
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
59
import { getSerdePlugin } from "@smithy/middleware-serde";
610
import { Command as $Command } from "@smithy/smithy-client";
@@ -71,10 +75,6 @@ export class OnlyHttpApiKeyAndBearerAuthReversedCommand extends $Command
7175
.s("Weather", "OnlyHttpApiKeyAndBearerAuthReversed", {})
7276
.n("WeatherClient", "OnlyHttpApiKeyAndBearerAuthReversedCommand")
7377
.f(void 0, void 0)
74-
.ser(() => {
75-
throw new Error("No supported protocol was found");
76-
})
77-
.de(() => {
78-
throw new Error("No supported protocol was found");
79-
})
78+
.ser(se_OnlyHttpApiKeyAndBearerAuthReversedCommand)
79+
.de(de_OnlyHttpApiKeyAndBearerAuthReversedCommand)
8080
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpApiKeyAuthCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
33
import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth";
4+
import { de_OnlyHttpApiKeyAuthCommand, se_OnlyHttpApiKeyAuthCommand } from "../protocols/Aws_restJson1";
45
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
56
import { getSerdePlugin } from "@smithy/middleware-serde";
67
import { Command as $Command } from "@smithy/smithy-client";
@@ -71,10 +72,6 @@ export class OnlyHttpApiKeyAuthCommand extends $Command
7172
.s("Weather", "OnlyHttpApiKeyAuth", {})
7273
.n("WeatherClient", "OnlyHttpApiKeyAuthCommand")
7374
.f(void 0, void 0)
74-
.ser(() => {
75-
throw new Error("No supported protocol was found");
76-
})
77-
.de(() => {
78-
throw new Error("No supported protocol was found");
79-
})
75+
.ser(se_OnlyHttpApiKeyAuthCommand)
76+
.de(de_OnlyHttpApiKeyAuthCommand)
8077
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpApiKeyAuthOptionalCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlyHttpApiKeyAuthOptionalCommand, se_OnlyHttpApiKeyAuthOptionalCommand } from "../protocols/Aws_restJson1";
34
import { getSerdePlugin } from "@smithy/middleware-serde";
45
import { Command as $Command } from "@smithy/smithy-client";
56
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
@@ -62,10 +63,6 @@ export class OnlyHttpApiKeyAuthOptionalCommand extends $Command
6263
.s("Weather", "OnlyHttpApiKeyAuthOptional", {})
6364
.n("WeatherClient", "OnlyHttpApiKeyAuthOptionalCommand")
6465
.f(void 0, void 0)
65-
.ser(() => {
66-
throw new Error("No supported protocol was found");
67-
})
68-
.de(() => {
69-
throw new Error("No supported protocol was found");
70-
})
66+
.ser(se_OnlyHttpApiKeyAuthOptionalCommand)
67+
.de(de_OnlyHttpApiKeyAuthOptionalCommand)
7168
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpBearerAuthCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlyHttpBearerAuthCommand, se_OnlyHttpBearerAuthCommand } from "../protocols/Aws_restJson1";
34
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
45
import { getSerdePlugin } from "@smithy/middleware-serde";
56
import { Command as $Command } from "@smithy/smithy-client";
@@ -63,10 +64,6 @@ export class OnlyHttpBearerAuthCommand extends $Command
6364
.s("Weather", "OnlyHttpBearerAuth", {})
6465
.n("WeatherClient", "OnlyHttpBearerAuthCommand")
6566
.f(void 0, void 0)
66-
.ser(() => {
67-
throw new Error("No supported protocol was found");
68-
})
69-
.de(() => {
70-
throw new Error("No supported protocol was found");
71-
})
67+
.ser(se_OnlyHttpBearerAuthCommand)
68+
.de(de_OnlyHttpBearerAuthCommand)
7269
.build() {}

private/weather-legacy-auth/src/commands/OnlyHttpBearerAuthOptionalCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlyHttpBearerAuthOptionalCommand, se_OnlyHttpBearerAuthOptionalCommand } from "../protocols/Aws_restJson1";
34
import { getSerdePlugin } from "@smithy/middleware-serde";
45
import { Command as $Command } from "@smithy/smithy-client";
56
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
@@ -62,10 +63,6 @@ export class OnlyHttpBearerAuthOptionalCommand extends $Command
6263
.s("Weather", "OnlyHttpBearerAuthOptional", {})
6364
.n("WeatherClient", "OnlyHttpBearerAuthOptionalCommand")
6465
.f(void 0, void 0)
65-
.ser(() => {
66-
throw new Error("No supported protocol was found");
67-
})
68-
.de(() => {
69-
throw new Error("No supported protocol was found");
70-
})
66+
.ser(se_OnlyHttpBearerAuthOptionalCommand)
67+
.de(de_OnlyHttpBearerAuthOptionalCommand)
7168
.build() {}

private/weather-legacy-auth/src/commands/OnlySigv4AuthCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlySigv4AuthCommand, se_OnlySigv4AuthCommand } from "../protocols/Aws_restJson1";
34
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
45
import { getSerdePlugin } from "@smithy/middleware-serde";
56
import { Command as $Command } from "@smithy/smithy-client";
@@ -63,10 +64,6 @@ export class OnlySigv4AuthCommand extends $Command
6364
.s("Weather", "OnlySigv4Auth", {})
6465
.n("WeatherClient", "OnlySigv4AuthCommand")
6566
.f(void 0, void 0)
66-
.ser(() => {
67-
throw new Error("No supported protocol was found");
68-
})
69-
.de(() => {
70-
throw new Error("No supported protocol was found");
71-
})
67+
.ser(se_OnlySigv4AuthCommand)
68+
.de(de_OnlySigv4AuthCommand)
7269
.build() {}

private/weather-legacy-auth/src/commands/OnlySigv4AuthOptionalCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
3+
import { de_OnlySigv4AuthOptionalCommand, se_OnlySigv4AuthOptionalCommand } from "../protocols/Aws_restJson1";
34
import { getSerdePlugin } from "@smithy/middleware-serde";
45
import { Command as $Command } from "@smithy/smithy-client";
56
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
@@ -62,10 +63,6 @@ export class OnlySigv4AuthOptionalCommand extends $Command
6263
.s("Weather", "OnlySigv4AuthOptional", {})
6364
.n("WeatherClient", "OnlySigv4AuthOptionalCommand")
6465
.f(void 0, void 0)
65-
.ser(() => {
66-
throw new Error("No supported protocol was found");
67-
})
68-
.de(() => {
69-
throw new Error("No supported protocol was found");
70-
})
66+
.ser(se_OnlySigv4AuthOptionalCommand)
67+
.de(de_OnlySigv4AuthOptionalCommand)
7168
.build() {}

private/weather-legacy-auth/src/commands/SameAsServiceCommand.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import { ServiceInputTypes, ServiceOutputTypes, WeatherClientResolvedConfig } from "../WeatherClient";
33
import { SameAsServiceOutput } from "../models/models_0";
4+
import { de_SameAsServiceCommand, se_SameAsServiceCommand } from "../protocols/Aws_restJson1";
45
import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing";
56
import { getSerdePlugin } from "@smithy/middleware-serde";
67
import { Command as $Command } from "@smithy/smithy-client";
@@ -66,10 +67,6 @@ export class SameAsServiceCommand extends $Command
6667
.s("Weather", "SameAsService", {})
6768
.n("WeatherClient", "SameAsServiceCommand")
6869
.f(void 0, void 0)
69-
.ser(() => {
70-
throw new Error("No supported protocol was found");
71-
})
72-
.de(() => {
73-
throw new Error("No supported protocol was found");
74-
})
70+
.ser(se_SameAsServiceCommand)
71+
.de(de_SameAsServiceCommand)
7572
.build() {}

0 commit comments

Comments
 (0)