(
+ config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved
+): T & HttpAuthSchemeResolvedConfig => {
+ const config_0 = resolveAwsSdkSigV4Config(config);
+ return {
+ ...config_0,
+ } as T & HttpAuthSchemeResolvedConfig;
+};
diff --git a/private/aws-protocoltests-restxml-s3/src/commands/DeleteObjectTaggingCommand.ts b/private/aws-protocoltests-restxml-s3/src/commands/DeleteObjectTaggingCommand.ts
new file mode 100644
index 000000000000..8930ea5fb0a3
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/commands/DeleteObjectTaggingCommand.ts
@@ -0,0 +1,78 @@
+// smithy-typescript generated code
+import { getBucketEndpointPlugin } from "@aws-sdk/middleware-bucket-endpoint";
+import { getSerdePlugin } from "@smithy/middleware-serde";
+import { Command as $Command } from "@smithy/smithy-client";
+import { MetadataBearer as __MetadataBearer } from "@smithy/types";
+
+import { DeleteObjectTaggingOutput, DeleteObjectTaggingRequest } from "../models/models_0";
+import { de_DeleteObjectTaggingCommand, se_DeleteObjectTaggingCommand } from "../protocols/Aws_restXml";
+import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client";
+
+/**
+ * @public
+ */
+export type { __MetadataBearer };
+export { $Command };
+/**
+ * @public
+ *
+ * The input for {@link DeleteObjectTaggingCommand}.
+ */
+export interface DeleteObjectTaggingCommandInput extends DeleteObjectTaggingRequest {}
+/**
+ * @public
+ *
+ * The output of {@link DeleteObjectTaggingCommand}.
+ */
+export interface DeleteObjectTaggingCommandOutput extends DeleteObjectTaggingOutput, __MetadataBearer {}
+
+/**
+ * @public
+ *
+ * @example
+ * Use a bare-bones client and the command you need to make an API call.
+ * ```javascript
+ * import { S3Client, DeleteObjectTaggingCommand } from "@aws-sdk/aws-protocoltests-restxml-s3"; // ES Modules import
+ * // const { S3Client, DeleteObjectTaggingCommand } = require("@aws-sdk/aws-protocoltests-restxml-s3"); // CommonJS import
+ * const client = new S3Client(config);
+ * const input = { // DeleteObjectTaggingRequest
+ * Bucket: "STRING_VALUE", // required
+ * Key: "STRING_VALUE", // required
+ * VersionId: "STRING_VALUE",
+ * ExpectedBucketOwner: "STRING_VALUE",
+ * };
+ * const command = new DeleteObjectTaggingCommand(input);
+ * const response = await client.send(command);
+ * // { // DeleteObjectTaggingOutput
+ * // VersionId: "STRING_VALUE",
+ * // };
+ *
+ * ```
+ *
+ * @param DeleteObjectTaggingCommandInput - {@link DeleteObjectTaggingCommandInput}
+ * @returns {@link DeleteObjectTaggingCommandOutput}
+ * @see {@link DeleteObjectTaggingCommandInput} for command's `input` shape.
+ * @see {@link DeleteObjectTaggingCommandOutput} for command's `response` shape.
+ * @see {@link S3ClientResolvedConfig | config} for S3Client's `config` shape.
+ *
+ * @throws {@link S3ServiceException}
+ * Base exception class for all service exceptions from S3 service.
+ *
+ */
+export class DeleteObjectTaggingCommand extends $Command
+ .classBuilder<
+ DeleteObjectTaggingCommandInput,
+ DeleteObjectTaggingCommandOutput,
+ S3ClientResolvedConfig,
+ ServiceInputTypes,
+ ServiceOutputTypes
+ >()
+ .m(function (this: any, Command: any, cs: any, config: S3ClientResolvedConfig, o: any) {
+ return [getSerdePlugin(config, this.serialize, this.deserialize), getBucketEndpointPlugin(config)];
+ })
+ .s("AmazonS3", "DeleteObjectTagging", {})
+ .n("S3Client", "DeleteObjectTaggingCommand")
+ .f(void 0, void 0)
+ .ser(se_DeleteObjectTaggingCommand)
+ .de(de_DeleteObjectTaggingCommand)
+ .build() {}
diff --git a/private/aws-protocoltests-restxml-s3/src/commands/GetBucketLocationCommand.ts b/private/aws-protocoltests-restxml-s3/src/commands/GetBucketLocationCommand.ts
new file mode 100644
index 000000000000..d44e895f94db
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/commands/GetBucketLocationCommand.ts
@@ -0,0 +1,75 @@
+// smithy-typescript generated code
+import { getBucketEndpointPlugin } from "@aws-sdk/middleware-bucket-endpoint";
+import { getSerdePlugin } from "@smithy/middleware-serde";
+import { Command as $Command } from "@smithy/smithy-client";
+import { MetadataBearer as __MetadataBearer } from "@smithy/types";
+
+import { GetBucketLocationOutput, GetBucketLocationRequest } from "../models/models_0";
+import { de_GetBucketLocationCommand, se_GetBucketLocationCommand } from "../protocols/Aws_restXml";
+import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client";
+
+/**
+ * @public
+ */
+export type { __MetadataBearer };
+export { $Command };
+/**
+ * @public
+ *
+ * The input for {@link GetBucketLocationCommand}.
+ */
+export interface GetBucketLocationCommandInput extends GetBucketLocationRequest {}
+/**
+ * @public
+ *
+ * The output of {@link GetBucketLocationCommand}.
+ */
+export interface GetBucketLocationCommandOutput extends GetBucketLocationOutput, __MetadataBearer {}
+
+/**
+ * @public
+ *
+ * @example
+ * Use a bare-bones client and the command you need to make an API call.
+ * ```javascript
+ * import { S3Client, GetBucketLocationCommand } from "@aws-sdk/aws-protocoltests-restxml-s3"; // ES Modules import
+ * // const { S3Client, GetBucketLocationCommand } = require("@aws-sdk/aws-protocoltests-restxml-s3"); // CommonJS import
+ * const client = new S3Client(config);
+ * const input = { // GetBucketLocationRequest
+ * Bucket: "STRING_VALUE", // required
+ * };
+ * const command = new GetBucketLocationCommand(input);
+ * const response = await client.send(command);
+ * // { // GetBucketLocationOutput
+ * // LocationConstraint: "us-west-2",
+ * // };
+ *
+ * ```
+ *
+ * @param GetBucketLocationCommandInput - {@link GetBucketLocationCommandInput}
+ * @returns {@link GetBucketLocationCommandOutput}
+ * @see {@link GetBucketLocationCommandInput} for command's `input` shape.
+ * @see {@link GetBucketLocationCommandOutput} for command's `response` shape.
+ * @see {@link S3ClientResolvedConfig | config} for S3Client's `config` shape.
+ *
+ * @throws {@link S3ServiceException}
+ * Base exception class for all service exceptions from S3 service.
+ *
+ */
+export class GetBucketLocationCommand extends $Command
+ .classBuilder<
+ GetBucketLocationCommandInput,
+ GetBucketLocationCommandOutput,
+ S3ClientResolvedConfig,
+ ServiceInputTypes,
+ ServiceOutputTypes
+ >()
+ .m(function (this: any, Command: any, cs: any, config: S3ClientResolvedConfig, o: any) {
+ return [getSerdePlugin(config, this.serialize, this.deserialize), getBucketEndpointPlugin(config)];
+ })
+ .s("AmazonS3", "GetBucketLocation", {})
+ .n("S3Client", "GetBucketLocationCommand")
+ .f(void 0, void 0)
+ .ser(se_GetBucketLocationCommand)
+ .de(de_GetBucketLocationCommand)
+ .build() {}
diff --git a/private/aws-protocoltests-restxml-s3/src/commands/GetObjectCommand.ts b/private/aws-protocoltests-restxml-s3/src/commands/GetObjectCommand.ts
new file mode 100644
index 000000000000..57afa9e935b7
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/commands/GetObjectCommand.ts
@@ -0,0 +1,74 @@
+// smithy-typescript generated code
+import { getBucketEndpointPlugin } from "@aws-sdk/middleware-bucket-endpoint";
+import { getSerdePlugin } from "@smithy/middleware-serde";
+import { Command as $Command } from "@smithy/smithy-client";
+import { MetadataBearer as __MetadataBearer } from "@smithy/types";
+
+import { GetObjectOutput, GetObjectRequest } from "../models/models_0";
+import { de_GetObjectCommand, se_GetObjectCommand } from "../protocols/Aws_restXml";
+import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client";
+
+/**
+ * @public
+ */
+export type { __MetadataBearer };
+export { $Command };
+/**
+ * @public
+ *
+ * The input for {@link GetObjectCommand}.
+ */
+export interface GetObjectCommandInput extends GetObjectRequest {}
+/**
+ * @public
+ *
+ * The output of {@link GetObjectCommand}.
+ */
+export interface GetObjectCommandOutput extends GetObjectOutput, __MetadataBearer {}
+
+/**
+ * @public
+ *
+ * @example
+ * Use a bare-bones client and the command you need to make an API call.
+ * ```javascript
+ * import { S3Client, GetObjectCommand } from "@aws-sdk/aws-protocoltests-restxml-s3"; // ES Modules import
+ * // const { S3Client, GetObjectCommand } = require("@aws-sdk/aws-protocoltests-restxml-s3"); // CommonJS import
+ * const client = new S3Client(config);
+ * const input = { // GetObjectRequest
+ * Bucket: "STRING_VALUE", // required
+ * Key: "STRING_VALUE", // required
+ * };
+ * const command = new GetObjectCommand(input);
+ * const response = await client.send(command);
+ * // {};
+ *
+ * ```
+ *
+ * @param GetObjectCommandInput - {@link GetObjectCommandInput}
+ * @returns {@link GetObjectCommandOutput}
+ * @see {@link GetObjectCommandInput} for command's `input` shape.
+ * @see {@link GetObjectCommandOutput} for command's `response` shape.
+ * @see {@link S3ClientResolvedConfig | config} for S3Client's `config` shape.
+ *
+ * @throws {@link S3ServiceException}
+ * Base exception class for all service exceptions from S3 service.
+ *
+ */
+export class GetObjectCommand extends $Command
+ .classBuilder<
+ GetObjectCommandInput,
+ GetObjectCommandOutput,
+ S3ClientResolvedConfig,
+ ServiceInputTypes,
+ ServiceOutputTypes
+ >()
+ .m(function (this: any, Command: any, cs: any, config: S3ClientResolvedConfig, o: any) {
+ return [getSerdePlugin(config, this.serialize, this.deserialize), getBucketEndpointPlugin(config)];
+ })
+ .s("AmazonS3", "GetObject", {})
+ .n("S3Client", "GetObjectCommand")
+ .f(void 0, void 0)
+ .ser(se_GetObjectCommand)
+ .de(de_GetObjectCommand)
+ .build() {}
diff --git a/private/aws-protocoltests-restxml-s3/src/commands/ListObjectsV2Command.ts b/private/aws-protocoltests-restxml-s3/src/commands/ListObjectsV2Command.ts
new file mode 100644
index 000000000000..3d18f53a67af
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/commands/ListObjectsV2Command.ts
@@ -0,0 +1,113 @@
+// smithy-typescript generated code
+import { getBucketEndpointPlugin } from "@aws-sdk/middleware-bucket-endpoint";
+import { getSerdePlugin } from "@smithy/middleware-serde";
+import { Command as $Command } from "@smithy/smithy-client";
+import { MetadataBearer as __MetadataBearer } from "@smithy/types";
+
+import { ListObjectsV2Output, ListObjectsV2Request } from "../models/models_0";
+import { de_ListObjectsV2Command, se_ListObjectsV2Command } from "../protocols/Aws_restXml";
+import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client";
+
+/**
+ * @public
+ */
+export type { __MetadataBearer };
+export { $Command };
+/**
+ * @public
+ *
+ * The input for {@link ListObjectsV2Command}.
+ */
+export interface ListObjectsV2CommandInput extends ListObjectsV2Request {}
+/**
+ * @public
+ *
+ * The output of {@link ListObjectsV2Command}.
+ */
+export interface ListObjectsV2CommandOutput extends ListObjectsV2Output, __MetadataBearer {}
+
+/**
+ * @public
+ *
+ * @example
+ * Use a bare-bones client and the command you need to make an API call.
+ * ```javascript
+ * import { S3Client, ListObjectsV2Command } from "@aws-sdk/aws-protocoltests-restxml-s3"; // ES Modules import
+ * // const { S3Client, ListObjectsV2Command } = require("@aws-sdk/aws-protocoltests-restxml-s3"); // CommonJS import
+ * const client = new S3Client(config);
+ * const input = { // ListObjectsV2Request
+ * Bucket: "STRING_VALUE", // required
+ * Delimiter: "STRING_VALUE",
+ * EncodingType: "url",
+ * MaxKeys: Number("int"),
+ * Prefix: "STRING_VALUE",
+ * ContinuationToken: "STRING_VALUE",
+ * FetchOwner: true || false,
+ * StartAfter: "STRING_VALUE",
+ * RequestPayer: "requester",
+ * ExpectedBucketOwner: "STRING_VALUE",
+ * };
+ * const command = new ListObjectsV2Command(input);
+ * const response = await client.send(command);
+ * // { // ListObjectsV2Output
+ * // IsTruncated: true || false,
+ * // Contents: [ // ObjectList
+ * // { // Object
+ * // Key: "STRING_VALUE",
+ * // LastModified: new Date("TIMESTAMP"),
+ * // ETag: "STRING_VALUE",
+ * // Size: Number("int"),
+ * // StorageClass: "STANDARD" || "REDUCED_REDUNDANCY" || "GLACIER" || "STANDARD_IA" || "ONEZONE_IA" || "INTELLIGENT_TIERING" || "DEEP_ARCHIVE" || "OUTPOSTS",
+ * // Owner: { // Owner
+ * // DisplayName: "STRING_VALUE",
+ * // ID: "STRING_VALUE",
+ * // },
+ * // },
+ * // ],
+ * // Name: "STRING_VALUE",
+ * // Prefix: "STRING_VALUE",
+ * // Delimiter: "STRING_VALUE",
+ * // MaxKeys: Number("int"),
+ * // CommonPrefixes: [ // CommonPrefixList
+ * // { // CommonPrefix
+ * // Prefix: "STRING_VALUE",
+ * // },
+ * // ],
+ * // EncodingType: "url",
+ * // KeyCount: Number("int"),
+ * // ContinuationToken: "STRING_VALUE",
+ * // NextContinuationToken: "STRING_VALUE",
+ * // StartAfter: "STRING_VALUE",
+ * // };
+ *
+ * ```
+ *
+ * @param ListObjectsV2CommandInput - {@link ListObjectsV2CommandInput}
+ * @returns {@link ListObjectsV2CommandOutput}
+ * @see {@link ListObjectsV2CommandInput} for command's `input` shape.
+ * @see {@link ListObjectsV2CommandOutput} for command's `response` shape.
+ * @see {@link S3ClientResolvedConfig | config} for S3Client's `config` shape.
+ *
+ * @throws {@link NoSuchBucket} (client fault)
+ *
+ * @throws {@link S3ServiceException}
+ * Base exception class for all service exceptions from S3 service.
+ *
+ */
+export class ListObjectsV2Command extends $Command
+ .classBuilder<
+ ListObjectsV2CommandInput,
+ ListObjectsV2CommandOutput,
+ S3ClientResolvedConfig,
+ ServiceInputTypes,
+ ServiceOutputTypes
+ >()
+ .m(function (this: any, Command: any, cs: any, config: S3ClientResolvedConfig, o: any) {
+ return [getSerdePlugin(config, this.serialize, this.deserialize), getBucketEndpointPlugin(config)];
+ })
+ .s("AmazonS3", "ListObjectsV2", {})
+ .n("S3Client", "ListObjectsV2Command")
+ .f(void 0, void 0)
+ .ser(se_ListObjectsV2Command)
+ .de(de_ListObjectsV2Command)
+ .build() {}
diff --git a/private/aws-protocoltests-restxml-s3/src/commands/index.ts b/private/aws-protocoltests-restxml-s3/src/commands/index.ts
new file mode 100644
index 000000000000..4c7207866971
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/commands/index.ts
@@ -0,0 +1,5 @@
+// smithy-typescript generated code
+export * from "./DeleteObjectTaggingCommand";
+export * from "./GetBucketLocationCommand";
+export * from "./GetObjectCommand";
+export * from "./ListObjectsV2Command";
diff --git a/private/aws-protocoltests-restxml-s3/src/endpoints.ts b/private/aws-protocoltests-restxml-s3/src/endpoints.ts
new file mode 100644
index 000000000000..811908c7ad7f
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/endpoints.ts
@@ -0,0 +1,594 @@
+// smithy-typescript generated code
+import { RegionInfoProvider, RegionInfoProviderOptions } from "@aws-sdk/types";
+import { getRegionInfo, PartitionHash, RegionHash } from "@smithy/config-resolver";
+
+const regionHash: RegionHash = {
+ "af-south-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.af-south-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-east-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-east-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-northeast-1": {
+ variants: [
+ {
+ hostname: "s3.ap-northeast-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3.dualstack.ap-northeast-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-northeast-2": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-northeast-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-northeast-3": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-northeast-3.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-south-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-south-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-south-2": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-south-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-southeast-1": {
+ variants: [
+ {
+ hostname: "s3.ap-southeast-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3.dualstack.ap-southeast-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-southeast-2": {
+ variants: [
+ {
+ hostname: "s3.ap-southeast-2.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3.dualstack.ap-southeast-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-southeast-3": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-southeast-3.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ap-southeast-4": {
+ variants: [
+ {
+ hostname: "s3.dualstack.ap-southeast-4.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "aws-global": {
+ variants: [
+ {
+ hostname: "s3.amazonaws.com",
+ tags: [],
+ },
+ ],
+ signingRegion: "us-east-1",
+ },
+ "ca-central-1": {
+ variants: [
+ {
+ hostname: "s3-fips.ca-central-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3-fips.dualstack.ca-central-1.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3.dualstack.ca-central-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "ca-west-1": {
+ variants: [
+ {
+ hostname: "s3-fips.ca-west-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3-fips.dualstack.ca-west-1.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3.dualstack.ca-west-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "cn-north-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "cn-northwest-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-central-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-central-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-central-2": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-central-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-north-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-north-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-south-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-south-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-south-2": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-south-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-west-1": {
+ variants: [
+ {
+ hostname: "s3.eu-west-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3.dualstack.eu-west-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-west-2": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-west-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "eu-west-3": {
+ variants: [
+ {
+ hostname: "s3.dualstack.eu-west-3.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "il-central-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.il-central-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "me-central-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.me-central-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "me-south-1": {
+ variants: [
+ {
+ hostname: "s3.dualstack.me-south-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "s3-external-1": {
+ variants: [
+ {
+ hostname: "s3-external-1.amazonaws.com",
+ tags: [],
+ },
+ ],
+ signingRegion: "us-east-1",
+ },
+ "sa-east-1": {
+ variants: [
+ {
+ hostname: "s3.sa-east-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3.dualstack.sa-east-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-east-1": {
+ variants: [
+ {
+ hostname: "s3.us-east-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.dualstack.us-east-1.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-east-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-east-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-east-2": {
+ variants: [
+ {
+ hostname: "s3-fips.dualstack.us-east-2.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-east-2.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-east-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-gov-east-1": {
+ variants: [
+ {
+ hostname: "s3.us-gov-east-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.us-gov-east-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-gov-east-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-gov-west-1": {
+ variants: [
+ {
+ hostname: "s3.us-gov-west-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.us-gov-west-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-gov-west-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-iso-east-1": {
+ variants: [
+ {
+ hostname: "s3-fips.dualstack.us-iso-east-1.c2s.ic.gov",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-iso-east-1.c2s.ic.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "us-iso-west-1": {
+ variants: [
+ {
+ hostname: "s3-fips.dualstack.us-iso-west-1.c2s.ic.gov",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-iso-west-1.c2s.ic.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "us-isob-east-1": {
+ variants: [
+ {
+ hostname: "s3-fips.dualstack.us-isob-east-1.sc2s.sgov.gov",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-isob-east-1.sc2s.sgov.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "us-west-1": {
+ variants: [
+ {
+ hostname: "s3.us-west-1.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.dualstack.us-west-1.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-west-1.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-west-1.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "us-west-2": {
+ variants: [
+ {
+ hostname: "s3.us-west-2.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.dualstack.us-west-2.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3-fips.us-west-2.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3.dualstack.us-west-2.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+};
+
+const partitionHash: PartitionHash = {
+ aws: {
+ regions: [
+ "af-south-1",
+ "ap-east-1",
+ "ap-northeast-1",
+ "ap-northeast-2",
+ "ap-northeast-3",
+ "ap-south-1",
+ "ap-south-2",
+ "ap-southeast-1",
+ "ap-southeast-2",
+ "ap-southeast-3",
+ "ap-southeast-4",
+ "aws-global",
+ "ca-central-1",
+ "ca-west-1",
+ "eu-central-1",
+ "eu-central-2",
+ "eu-north-1",
+ "eu-south-1",
+ "eu-south-2",
+ "eu-west-1",
+ "eu-west-2",
+ "eu-west-3",
+ "fips-ca-central-1",
+ "fips-ca-west-1",
+ "fips-us-east-1",
+ "fips-us-east-2",
+ "fips-us-west-1",
+ "fips-us-west-2",
+ "il-central-1",
+ "me-central-1",
+ "me-south-1",
+ "s3-external-1",
+ "sa-east-1",
+ "us-east-1",
+ "us-east-2",
+ "us-west-1",
+ "us-west-2",
+ ],
+ regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3-fips.dualstack.{region}.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3.dualstack.{region}.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "aws-cn": {
+ regions: ["cn-north-1", "cn-northwest-1"],
+ regionRegex: "^cn\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.amazonaws.com.cn",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.amazonaws.com.cn",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3-fips.{region}.api.amazonwebservices.com.cn",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3.dualstack.{region}.amazonaws.com.cn",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+ "aws-iso": {
+ regions: ["fips-us-iso-east-1", "fips-us-iso-west-1", "us-iso-east-1", "us-iso-west-1"],
+ regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.c2s.ic.gov",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.c2s.ic.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "aws-iso-b": {
+ regions: ["fips-us-isob-east-1", "us-isob-east-1"],
+ regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.sc2s.sgov.gov",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.sc2s.sgov.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "aws-iso-e": {
+ regions: ["eu-isoe-west-1"],
+ regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.cloud.adc-e.uk",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.cloud.adc-e.uk",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "aws-iso-f": {
+ regions: [],
+ regionRegex: "^us\\-isof\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.csp.hci.ic.gov",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.csp.hci.ic.gov",
+ tags: ["fips"],
+ },
+ ],
+ },
+ "aws-us-gov": {
+ regions: ["fips-us-gov-east-1", "fips-us-gov-west-1", "us-gov-east-1", "us-gov-west-1"],
+ regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
+ variants: [
+ {
+ hostname: "s3.{region}.amazonaws.com",
+ tags: [],
+ },
+ {
+ hostname: "s3-fips.{region}.amazonaws.com",
+ tags: ["fips"],
+ },
+ {
+ hostname: "s3-fips.dualstack.{region}.amazonaws.com",
+ tags: ["dualstack", "fips"],
+ },
+ {
+ hostname: "s3.dualstack.{region}.amazonaws.com",
+ tags: ["dualstack"],
+ },
+ ],
+ },
+};
+
+export const defaultRegionInfoProvider: RegionInfoProvider = async (
+ region: string,
+ options?: RegionInfoProviderOptions
+) =>
+ getRegionInfo(region, {
+ ...options,
+ signingService: "s3",
+ regionHash,
+ partitionHash,
+ });
diff --git a/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts b/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
new file mode 100644
index 000000000000..5acc0f2effcc
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
@@ -0,0 +1,15 @@
+// smithy-typescript generated code
+import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
+import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
+import { DefaultExtensionConfiguration } from "@smithy/types";
+
+import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration";
+
+/**
+ * @internal
+ */
+export interface S3ExtensionConfiguration
+ extends HttpHandlerExtensionConfiguration,
+ DefaultExtensionConfiguration,
+ AwsRegionExtensionConfiguration,
+ HttpAuthExtensionConfiguration {}
diff --git a/private/aws-protocoltests-restxml-s3/src/index.ts b/private/aws-protocoltests-restxml-s3/src/index.ts
new file mode 100644
index 000000000000..20be7e038683
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/index.ts
@@ -0,0 +1,11 @@
+// smithy-typescript generated code
+/* eslint-disable */
+export * from "./S3Client";
+export * from "./S3";
+export type { RuntimeExtension } from "./runtimeExtensions";
+export type { S3ExtensionConfiguration } from "./extensionConfiguration";
+export * from "./commands";
+export * from "./pagination";
+export * from "./models";
+
+export { S3ServiceException } from "./models/S3ServiceException";
diff --git a/private/aws-protocoltests-restxml-s3/src/models/S3ServiceException.ts b/private/aws-protocoltests-restxml-s3/src/models/S3ServiceException.ts
new file mode 100644
index 000000000000..14dd9550605b
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/models/S3ServiceException.ts
@@ -0,0 +1,24 @@
+// smithy-typescript generated code
+import {
+ ServiceException as __ServiceException,
+ ServiceExceptionOptions as __ServiceExceptionOptions,
+} from "@smithy/smithy-client";
+
+export type { __ServiceExceptionOptions };
+
+export { __ServiceException };
+
+/**
+ * @public
+ *
+ * Base exception class for all service exceptions from S3 service.
+ */
+export class S3ServiceException extends __ServiceException {
+ /**
+ * @internal
+ */
+ constructor(options: __ServiceExceptionOptions) {
+ super(options);
+ Object.setPrototypeOf(this, S3ServiceException.prototype);
+ }
+}
diff --git a/private/aws-protocoltests-restxml-s3/src/models/index.ts b/private/aws-protocoltests-restxml-s3/src/models/index.ts
new file mode 100644
index 000000000000..9eaceb12865f
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/models/index.ts
@@ -0,0 +1,2 @@
+// smithy-typescript generated code
+export * from "./models_0";
diff --git a/private/aws-protocoltests-restxml-s3/src/models/models_0.ts b/private/aws-protocoltests-restxml-s3/src/models/models_0.ts
new file mode 100644
index 000000000000..9ebb10dc31c5
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/models/models_0.ts
@@ -0,0 +1,183 @@
+// smithy-typescript generated code
+import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
+
+import { S3ServiceException as __BaseException } from "./S3ServiceException";
+
+/**
+ * @public
+ */
+export interface DeleteObjectTaggingOutput {
+ VersionId?: string;
+}
+
+/**
+ * @public
+ */
+export interface DeleteObjectTaggingRequest {
+ Bucket: string | undefined;
+ Key: string | undefined;
+ VersionId?: string;
+ ExpectedBucketOwner?: string;
+}
+
+/**
+ * @public
+ * @enum
+ */
+export const BucketLocationConstraint = {
+ us_west_2: "us-west-2",
+} as const;
+/**
+ * @public
+ */
+export type BucketLocationConstraint = (typeof BucketLocationConstraint)[keyof typeof BucketLocationConstraint];
+
+/**
+ * @public
+ */
+export interface GetBucketLocationOutput {
+ LocationConstraint?: BucketLocationConstraint;
+}
+
+/**
+ * @public
+ */
+export interface GetBucketLocationRequest {
+ Bucket: string | undefined;
+}
+
+/**
+ * @public
+ */
+export interface GetObjectOutput {}
+
+/**
+ * @public
+ */
+export interface GetObjectRequest {
+ Bucket: string | undefined;
+ Key: string | undefined;
+}
+
+/**
+ * @public
+ */
+export interface CommonPrefix {
+ Prefix?: string;
+}
+
+/**
+ * @public
+ */
+export interface Owner {
+ DisplayName?: string;
+ ID?: string;
+}
+
+/**
+ * @public
+ * @enum
+ */
+export const ObjectStorageClass = {
+ DEEP_ARCHIVE: "DEEP_ARCHIVE",
+ GLACIER: "GLACIER",
+ INTELLIGENT_TIERING: "INTELLIGENT_TIERING",
+ ONEZONE_IA: "ONEZONE_IA",
+ OUTPOSTS: "OUTPOSTS",
+ REDUCED_REDUNDANCY: "REDUCED_REDUNDANCY",
+ STANDARD: "STANDARD",
+ STANDARD_IA: "STANDARD_IA",
+} as const;
+/**
+ * @public
+ */
+export type ObjectStorageClass = (typeof ObjectStorageClass)[keyof typeof ObjectStorageClass];
+
+/**
+ * @public
+ */
+export interface _Object {
+ Key?: string;
+ LastModified?: Date;
+ ETag?: string;
+ Size?: number;
+ StorageClass?: ObjectStorageClass;
+ Owner?: Owner;
+}
+
+/**
+ * @public
+ * @enum
+ */
+export const EncodingType = {
+ url: "url",
+} as const;
+/**
+ * @public
+ */
+export type EncodingType = (typeof EncodingType)[keyof typeof EncodingType];
+
+/**
+ * @public
+ */
+export interface ListObjectsV2Output {
+ IsTruncated?: boolean;
+ Contents?: _Object[];
+ Name?: string;
+ Prefix?: string;
+ Delimiter?: string;
+ MaxKeys?: number;
+ CommonPrefixes?: CommonPrefix[];
+ EncodingType?: EncodingType;
+ KeyCount?: number;
+ ContinuationToken?: string;
+ NextContinuationToken?: string;
+ StartAfter?: string;
+}
+
+/**
+ * @public
+ * @enum
+ */
+export const RequestPayer = {
+ requester: "requester",
+} as const;
+/**
+ * @public
+ */
+export type RequestPayer = (typeof RequestPayer)[keyof typeof RequestPayer];
+
+/**
+ * @public
+ */
+export interface ListObjectsV2Request {
+ Bucket: string | undefined;
+ Delimiter?: string;
+ EncodingType?: EncodingType;
+ MaxKeys?: number;
+ Prefix?: string;
+ ContinuationToken?: string;
+ FetchOwner?: boolean;
+ StartAfter?: string;
+ RequestPayer?: RequestPayer;
+ ExpectedBucketOwner?: string;
+}
+
+/**
+ * @public
+ */
+export class NoSuchBucket extends __BaseException {
+ readonly name: "NoSuchBucket" = "NoSuchBucket";
+ readonly $fault: "client" = "client";
+ /**
+ * @internal
+ */
+ constructor(opts: __ExceptionOptionType) {
+ super({
+ name: "NoSuchBucket",
+ $fault: "client",
+ ...opts,
+ });
+ Object.setPrototypeOf(this, NoSuchBucket.prototype);
+ }
+}
diff --git a/private/aws-protocoltests-restxml-s3/src/pagination/Interfaces.ts b/private/aws-protocoltests-restxml-s3/src/pagination/Interfaces.ts
new file mode 100644
index 000000000000..e86088394a79
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/pagination/Interfaces.ts
@@ -0,0 +1,11 @@
+// smithy-typescript generated code
+import { PaginationConfiguration } from "@smithy/types";
+
+import { S3Client } from "../S3Client";
+
+/**
+ * @public
+ */
+export interface S3PaginationConfiguration extends PaginationConfiguration {
+ client: S3Client;
+}
diff --git a/private/aws-protocoltests-restxml-s3/src/pagination/ListObjectsV2Paginator.ts b/private/aws-protocoltests-restxml-s3/src/pagination/ListObjectsV2Paginator.ts
new file mode 100644
index 000000000000..75a6827f4f53
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/pagination/ListObjectsV2Paginator.ts
@@ -0,0 +1,24 @@
+// smithy-typescript generated code
+import { createPaginator } from "@smithy/core";
+import { Paginator } from "@smithy/types";
+
+import {
+ ListObjectsV2Command,
+ ListObjectsV2CommandInput,
+ ListObjectsV2CommandOutput,
+} from "../commands/ListObjectsV2Command";
+import { S3Client } from "../S3Client";
+import { S3PaginationConfiguration } from "./Interfaces";
+
+/**
+ * @public
+ */
+export const paginateListObjectsV2: (
+ config: S3PaginationConfiguration,
+ input: ListObjectsV2CommandInput,
+ ...rest: any[]
+) => Paginator = createPaginator<
+ S3PaginationConfiguration,
+ ListObjectsV2CommandInput,
+ ListObjectsV2CommandOutput
+>(S3Client, ListObjectsV2Command, "ContinuationToken", "NextContinuationToken", "MaxKeys");
diff --git a/private/aws-protocoltests-restxml-s3/src/pagination/index.ts b/private/aws-protocoltests-restxml-s3/src/pagination/index.ts
new file mode 100644
index 000000000000..df6d3be1b3ab
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/pagination/index.ts
@@ -0,0 +1,3 @@
+// smithy-typescript generated code
+export * from "./Interfaces";
+export * from "./ListObjectsV2Paginator";
diff --git a/private/aws-protocoltests-restxml-s3/src/protocols/Aws_restXml.ts b/private/aws-protocoltests-restxml-s3/src/protocols/Aws_restXml.ts
new file mode 100644
index 000000000000..45e4065a5321
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/protocols/Aws_restXml.ts
@@ -0,0 +1,404 @@
+// smithy-typescript generated code
+import { loadRestXmlErrorCode, parseXmlBody as parseBody, parseXmlErrorBody as parseErrorBody } from "@aws-sdk/core";
+import { requestBuilder as rb } from "@smithy/core";
+import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
+import {
+ collectBody,
+ decorateServiceException as __decorateServiceException,
+ expectNonNull as __expectNonNull,
+ expectObject as __expectObject,
+ expectString as __expectString,
+ extendedEncodeURIComponent as __extendedEncodeURIComponent,
+ getArrayIfSingleItem as __getArrayIfSingleItem,
+ map,
+ parseBoolean as __parseBoolean,
+ parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset,
+ resolvedPath as __resolvedPath,
+ strictParseInt32 as __strictParseInt32,
+ withBaseException,
+} from "@smithy/smithy-client";
+import {
+ Endpoint as __Endpoint,
+ ResponseMetadata as __ResponseMetadata,
+ SerdeContext as __SerdeContext,
+} from "@smithy/types";
+import { v4 as generateIdempotencyToken } from "uuid";
+
+import {
+ DeleteObjectTaggingCommandInput,
+ DeleteObjectTaggingCommandOutput,
+} from "../commands/DeleteObjectTaggingCommand";
+import { GetBucketLocationCommandInput, GetBucketLocationCommandOutput } from "../commands/GetBucketLocationCommand";
+import { GetObjectCommandInput, GetObjectCommandOutput } from "../commands/GetObjectCommand";
+import { ListObjectsV2CommandInput, ListObjectsV2CommandOutput } from "../commands/ListObjectsV2Command";
+import { _Object, CommonPrefix, NoSuchBucket, Owner } from "../models/models_0";
+import { S3ServiceException as __BaseException } from "../models/S3ServiceException";
+
+/**
+ * serializeAws_restXmlDeleteObjectTaggingCommand
+ */
+export const se_DeleteObjectTaggingCommand = async (
+ input: DeleteObjectTaggingCommandInput,
+ context: __SerdeContext
+): Promise<__HttpRequest> => {
+ const b = rb(input, context);
+ const headers: any = map({}, isSerializableHeaderValue, {
+ [_xaebo]: input[_EBO]!,
+ });
+ b.bp("/{Bucket}/{Key+}");
+ b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
+ b.p("Key", () => input.Key!, "{Key+}", true);
+ const query: any = map({
+ [_t]: [, ""],
+ [_vI]: [, input[_VI]!],
+ });
+ let body: any;
+ b.m("DELETE").h(headers).q(query).b(body);
+ return b.build();
+};
+
+/**
+ * serializeAws_restXmlGetBucketLocationCommand
+ */
+export const se_GetBucketLocationCommand = async (
+ input: GetBucketLocationCommandInput,
+ context: __SerdeContext
+): Promise<__HttpRequest> => {
+ const b = rb(input, context);
+ const headers: any = {};
+ b.bp("/{Bucket}");
+ b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
+ const query: any = map({
+ [_l]: [, ""],
+ });
+ let body: any;
+ b.m("GET").h(headers).q(query).b(body);
+ return b.build();
+};
+
+/**
+ * serializeAws_restXmlGetObjectCommand
+ */
+export const se_GetObjectCommand = async (
+ input: GetObjectCommandInput,
+ context: __SerdeContext
+): Promise<__HttpRequest> => {
+ const b = rb(input, context);
+ const headers: any = {};
+ b.bp("/{Bucket}/{Key+}");
+ b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
+ b.p("Key", () => input.Key!, "{Key+}", true);
+ let body: any;
+ b.m("GET").h(headers).b(body);
+ return b.build();
+};
+
+/**
+ * serializeAws_restXmlListObjectsV2Command
+ */
+export const se_ListObjectsV2Command = async (
+ input: ListObjectsV2CommandInput,
+ context: __SerdeContext
+): Promise<__HttpRequest> => {
+ const b = rb(input, context);
+ const headers: any = map({}, isSerializableHeaderValue, {
+ [_xarp]: input[_RP]!,
+ [_xaebo]: input[_EBO]!,
+ });
+ b.bp("/{Bucket}");
+ b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
+ const query: any = map({
+ [_lt]: [, "2"],
+ [_d]: [, input[_D]!],
+ [_et]: [, input[_ET]!],
+ [_mk]: [() => input.MaxKeys !== void 0, () => input[_MK]!.toString()],
+ [_p]: [, input[_P]!],
+ [_ct]: [, input[_CT]!],
+ [_fo]: [() => input.FetchOwner !== void 0, () => input[_FO]!.toString()],
+ [_sa]: [, input[_SA]!],
+ });
+ let body: any;
+ b.m("GET").h(headers).q(query).b(body);
+ return b.build();
+};
+
+/**
+ * deserializeAws_restXmlDeleteObjectTaggingCommand
+ */
+export const de_DeleteObjectTaggingCommand = async (
+ output: __HttpResponse,
+ context: __SerdeContext
+): Promise => {
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
+ return de_CommandError(output, context);
+ }
+ const contents: any = map({
+ $metadata: deserializeMetadata(output),
+ [_VI]: [, output.headers[_xavi]],
+ });
+ await collectBody(output.body, context);
+ return contents;
+};
+
+/**
+ * deserializeAws_restXmlGetBucketLocationCommand
+ */
+export const de_GetBucketLocationCommand = async (
+ output: __HttpResponse,
+ context: __SerdeContext
+): Promise => {
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
+ return de_CommandError(output, context);
+ }
+ const contents: any = map({
+ $metadata: deserializeMetadata(output),
+ });
+ const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
+ if (data[_LC] != null) {
+ contents[_LC] = __expectString(data[_LC]);
+ }
+ return contents;
+};
+
+/**
+ * deserializeAws_restXmlGetObjectCommand
+ */
+export const de_GetObjectCommand = async (
+ output: __HttpResponse,
+ context: __SerdeContext
+): Promise => {
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
+ return de_CommandError(output, context);
+ }
+ const contents: any = map({
+ $metadata: deserializeMetadata(output),
+ });
+ await collectBody(output.body, context);
+ return contents;
+};
+
+/**
+ * deserializeAws_restXmlListObjectsV2Command
+ */
+export const de_ListObjectsV2Command = async (
+ output: __HttpResponse,
+ context: __SerdeContext
+): Promise => {
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
+ return de_CommandError(output, context);
+ }
+ const contents: any = map({
+ $metadata: deserializeMetadata(output),
+ });
+ const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
+ if (data.CommonPrefixes === "") {
+ contents[_CP] = [];
+ } else if (data[_CP] != null) {
+ contents[_CP] = de_CommonPrefixList(__getArrayIfSingleItem(data[_CP]), context);
+ }
+ if (data.Contents === "") {
+ contents[_C] = [];
+ } else if (data[_C] != null) {
+ contents[_C] = de_ObjectList(__getArrayIfSingleItem(data[_C]), context);
+ }
+ if (data[_CT] != null) {
+ contents[_CT] = __expectString(data[_CT]);
+ }
+ if (data[_D] != null) {
+ contents[_D] = __expectString(data[_D]);
+ }
+ if (data[_ET] != null) {
+ contents[_ET] = __expectString(data[_ET]);
+ }
+ if (data[_IT] != null) {
+ contents[_IT] = __parseBoolean(data[_IT]);
+ }
+ if (data[_KC] != null) {
+ contents[_KC] = __strictParseInt32(data[_KC]) as number;
+ }
+ if (data[_MK] != null) {
+ contents[_MK] = __strictParseInt32(data[_MK]) as number;
+ }
+ if (data[_N] != null) {
+ contents[_N] = __expectString(data[_N]);
+ }
+ if (data[_NCT] != null) {
+ contents[_NCT] = __expectString(data[_NCT]);
+ }
+ if (data[_P] != null) {
+ contents[_P] = __expectString(data[_P]);
+ }
+ if (data[_SA] != null) {
+ contents[_SA] = __expectString(data[_SA]);
+ }
+ return contents;
+};
+
+/**
+ * deserialize_Aws_restXmlCommandError
+ */
+const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): Promise => {
+ const parsedOutput: any = {
+ ...output,
+ body: await parseErrorBody(output.body, context),
+ };
+ const errorCode = loadRestXmlErrorCode(output, parsedOutput.body);
+ switch (errorCode) {
+ case "NoSuchBucket":
+ case "com.amazonaws.s3#NoSuchBucket":
+ throw await de_NoSuchBucketRes(parsedOutput, context);
+ default:
+ const parsedBody = parsedOutput.body;
+ return throwDefaultError({
+ output,
+ parsedBody,
+ errorCode,
+ }) as never;
+ }
+};
+
+const throwDefaultError = withBaseException(__BaseException);
+/**
+ * deserializeAws_restXmlNoSuchBucketRes
+ */
+const de_NoSuchBucketRes = async (parsedOutput: any, context: __SerdeContext): Promise => {
+ const contents: any = map({});
+ const data: any = parsedOutput.body;
+ const exception = new NoSuchBucket({
+ $metadata: deserializeMetadata(parsedOutput),
+ ...contents,
+ });
+ return __decorateServiceException(exception, parsedOutput.body);
+};
+
+/**
+ * deserializeAws_restXmlCommonPrefix
+ */
+const de_CommonPrefix = (output: any, context: __SerdeContext): CommonPrefix => {
+ const contents: any = {};
+ if (output[_P] != null) {
+ contents[_P] = __expectString(output[_P]);
+ }
+ return contents;
+};
+
+/**
+ * deserializeAws_restXmlCommonPrefixList
+ */
+const de_CommonPrefixList = (output: any, context: __SerdeContext): CommonPrefix[] => {
+ return (output || [])
+ .filter((e: any) => e != null)
+ .map((entry: any) => {
+ return de_CommonPrefix(entry, context);
+ });
+};
+
+/**
+ * deserializeAws_restXml_Object
+ */
+const de__Object = (output: any, context: __SerdeContext): _Object => {
+ const contents: any = {};
+ if (output[_K] != null) {
+ contents[_K] = __expectString(output[_K]);
+ }
+ if (output[_LM] != null) {
+ contents[_LM] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_LM]));
+ }
+ if (output[_ETa] != null) {
+ contents[_ETa] = __expectString(output[_ETa]);
+ }
+ if (output[_S] != null) {
+ contents[_S] = __strictParseInt32(output[_S]) as number;
+ }
+ if (output[_SC] != null) {
+ contents[_SC] = __expectString(output[_SC]);
+ }
+ if (output[_O] != null) {
+ contents[_O] = de_Owner(output[_O], context);
+ }
+ return contents;
+};
+
+/**
+ * deserializeAws_restXmlObjectList
+ */
+const de_ObjectList = (output: any, context: __SerdeContext): _Object[] => {
+ return (output || [])
+ .filter((e: any) => e != null)
+ .map((entry: any) => {
+ return de__Object(entry, context);
+ });
+};
+
+/**
+ * deserializeAws_restXmlOwner
+ */
+const de_Owner = (output: any, context: __SerdeContext): Owner => {
+ const contents: any = {};
+ if (output[_DN] != null) {
+ contents[_DN] = __expectString(output[_DN]);
+ }
+ if (output[_ID] != null) {
+ contents[_ID] = __expectString(output[_ID]);
+ }
+ return contents;
+};
+
+const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
+ httpStatusCode: output.statusCode,
+ requestId:
+ output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
+ extendedRequestId: output.headers["x-amz-id-2"],
+ cfId: output.headers["x-amz-cf-id"],
+});
+
+// Encode Uint8Array data into string with utf-8.
+const collectBodyString = (streamBody: any, context: __SerdeContext): Promise =>
+ collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
+
+const isSerializableHeaderValue = (value: any): boolean =>
+ value !== undefined &&
+ value !== null &&
+ value !== "" &&
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
+
+const _C = "Contents";
+const _CP = "CommonPrefixes";
+const _CT = "ContinuationToken";
+const _D = "Delimiter";
+const _DN = "DisplayName";
+const _EBO = "ExpectedBucketOwner";
+const _ET = "EncodingType";
+const _ETa = "ETag";
+const _FO = "FetchOwner";
+const _ID = "ID";
+const _IT = "IsTruncated";
+const _K = "Key";
+const _KC = "KeyCount";
+const _LC = "LocationConstraint";
+const _LM = "LastModified";
+const _MK = "MaxKeys";
+const _N = "Name";
+const _NCT = "NextContinuationToken";
+const _O = "Owner";
+const _P = "Prefix";
+const _RP = "RequestPayer";
+const _S = "Size";
+const _SA = "StartAfter";
+const _SC = "StorageClass";
+const _VI = "VersionId";
+const _ct = "continuation-token";
+const _d = "delimiter";
+const _et = "encoding-type";
+const _fo = "fetch-owner";
+const _l = "location";
+const _lt = "list-type";
+const _mk = "max-keys";
+const _p = "prefix";
+const _sa = "start-after";
+const _t = "tagging";
+const _vI = "versionId";
+const _xaebo = "x-amz-expected-bucket-owner";
+const _xarp = "x-amz-request-payer";
+const _xavi = "x-amz-version-id";
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.browser.ts b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.browser.ts
new file mode 100644
index 000000000000..532ecc2909d9
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.browser.ts
@@ -0,0 +1,44 @@
+// smithy-typescript generated code
+// @ts-ignore: package.json will be imported from dist folders
+import packageInfo from "../package.json"; // eslint-disable-line
+
+import { Sha256 } from "@aws-crypto/sha256-browser";
+import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
+import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
+import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
+import { invalidProvider } from "@smithy/invalid-dependency";
+import { calculateBodyLength } from "@smithy/util-body-length-browser";
+import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
+import { S3ClientConfig } from "./S3Client";
+import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
+import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
+import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
+
+/**
+ * @internal
+ */
+export const getRuntimeConfig = (config: S3ClientConfig) => {
+ const defaultsMode = resolveDefaultsModeConfig(config);
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
+ const clientSharedValues = getSharedRuntimeConfig(config);
+ return {
+ ...clientSharedValues,
+ ...config,
+ runtime: "browser",
+ defaultsMode,
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
+ credentialDefaultProvider:
+ config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
+ defaultUserAgentProvider:
+ config?.defaultUserAgentProvider ??
+ defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
+ maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
+ region: config?.region ?? invalidProvider("Region is missing"),
+ requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
+ sha256: config?.sha256 ?? Sha256,
+ streamCollector: config?.streamCollector ?? streamCollector,
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
+ };
+};
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.native.ts b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.native.ts
new file mode 100644
index 000000000000..8cc71ac988e2
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.native.ts
@@ -0,0 +1,18 @@
+// smithy-typescript generated code
+import { Sha256 } from "@aws-crypto/sha256-js";
+
+import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
+import { S3ClientConfig } from "./S3Client";
+
+/**
+ * @internal
+ */
+export const getRuntimeConfig = (config: S3ClientConfig) => {
+ const browserDefaults = getBrowserRuntimeConfig(config);
+ return {
+ ...browserDefaults,
+ ...config,
+ runtime: "react-native",
+ sha256: config?.sha256 ?? Sha256,
+ };
+};
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
new file mode 100644
index 000000000000..82451633baa6
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
@@ -0,0 +1,47 @@
+// smithy-typescript generated code
+import { AwsSdkSigV4Signer } from "@aws-sdk/core";
+import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
+import { NoOpLogger } from "@smithy/smithy-client";
+import { IdentityProviderConfig } from "@smithy/types";
+import { parseUrl } from "@smithy/url-parser";
+import { fromBase64, toBase64 } from "@smithy/util-base64";
+import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
+
+import { defaultS3HttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
+import { defaultRegionInfoProvider } from "./endpoints";
+import { S3ClientConfig } from "./S3Client";
+
+/**
+ * @internal
+ */
+export const getRuntimeConfig = (config: S3ClientConfig) => {
+ return {
+ apiVersion: "2006-03-01",
+ base64Decoder: config?.base64Decoder ?? fromBase64,
+ base64Encoder: config?.base64Encoder ?? toBase64,
+ disableHostPrefix: config?.disableHostPrefix ?? false,
+ extensions: config?.extensions ?? [],
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultS3HttpAuthSchemeProvider,
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
+ {
+ schemeId: "aws.auth#sigv4",
+ identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"),
+ signer: new AwsSdkSigV4Signer(),
+ },
+ {
+ schemeId: "aws.auth#sigv4a",
+ identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4a"),
+ signer: new AwsSdkSigV4Signer(),
+ },
+ ],
+ logger: config?.logger ?? new NoOpLogger(),
+ regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
+ serviceId: config?.serviceId ?? "S3",
+ signerConstructor: config?.signerConstructor ?? SignatureV4MultiRegion,
+ signingEscapePath: config?.signingEscapePath ?? false,
+ urlParser: config?.urlParser ?? parseUrl,
+ useArnRegion: config?.useArnRegion ?? false,
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
+ utf8Encoder: config?.utf8Encoder ?? toUtf8,
+ };
+};
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.ts b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.ts
new file mode 100644
index 000000000000..72509551094d
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.ts
@@ -0,0 +1,64 @@
+// smithy-typescript generated code
+// @ts-ignore: package.json will be imported from dist folders
+import packageInfo from "../package.json"; // eslint-disable-line
+
+import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
+import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
+import { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
+import { NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS } from "@aws-sdk/middleware-sdk-s3";
+import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
+import {
+ NODE_REGION_CONFIG_FILE_OPTIONS,
+ NODE_REGION_CONFIG_OPTIONS,
+ NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
+ NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
+} from "@smithy/config-resolver";
+import { Hash } from "@smithy/hash-node";
+import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
+import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
+import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
+import { calculateBodyLength } from "@smithy/util-body-length-node";
+import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
+import { S3ClientConfig } from "./S3Client";
+import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
+import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
+import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
+import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
+
+/**
+ * @internal
+ */
+export const getRuntimeConfig = (config: S3ClientConfig) => {
+ emitWarningIfUnsupportedVersion(process.version);
+ const defaultsMode = resolveDefaultsModeConfig(config);
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
+ const clientSharedValues = getSharedRuntimeConfig(config);
+ awsCheckVersion(process.version);
+ return {
+ ...clientSharedValues,
+ ...config,
+ runtime: "node",
+ defaultsMode,
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
+ defaultUserAgentProvider:
+ config?.defaultUserAgentProvider ??
+ defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
+ disableS3ExpressSessionAuth:
+ config?.disableS3ExpressSessionAuth ?? loadNodeConfig(NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS),
+ maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
+ region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
+ requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
+ retryMode:
+ config?.retryMode ??
+ loadNodeConfig({
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
+ }),
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
+ streamCollector: config?.streamCollector ?? streamCollector,
+ useArnRegion: config?.useArnRegion ?? loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS),
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
+ };
+};
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts b/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
new file mode 100644
index 000000000000..9d8607cc18ec
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
@@ -0,0 +1,48 @@
+// smithy-typescript generated code
+import {
+ getAwsRegionExtensionConfiguration,
+ resolveAwsRegionExtensionConfiguration,
+} from "@aws-sdk/region-config-resolver";
+import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
+import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
+
+import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
+import { S3ExtensionConfiguration } from "./extensionConfiguration";
+
+/**
+ * @public
+ */
+export interface RuntimeExtension {
+ configure(extensionConfiguration: S3ExtensionConfiguration): void;
+}
+
+/**
+ * @public
+ */
+export interface RuntimeExtensionsConfig {
+ extensions: RuntimeExtension[];
+}
+
+const asPartial = >(t: T) => t;
+
+/**
+ * @internal
+ */
+export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: RuntimeExtension[]) => {
+ const extensionConfiguration: S3ExtensionConfiguration = {
+ ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
+ ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
+ ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
+ };
+
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
+
+ return {
+ ...runtimeConfig,
+ ...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
+ ...resolveDefaultRuntimeConfig(extensionConfiguration),
+ ...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration),
+ };
+};
diff --git a/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts b/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
new file mode 100644
index 000000000000..dbe0345d9caa
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
@@ -0,0 +1,648 @@
+// smithy-typescript generated code
+import { HttpHandler, HttpRequest, HttpResponse } from "@smithy/protocol-http";
+import { buildQueryString } from "@smithy/querystring-builder";
+import { HeaderBag, HttpHandlerOptions } from "@smithy/types";
+import { Readable } from "stream";
+
+import { DeleteObjectTaggingCommand } from "../../src/commands/DeleteObjectTaggingCommand";
+import { GetBucketLocationCommand } from "../../src/commands/GetBucketLocationCommand";
+import { GetObjectCommand } from "../../src/commands/GetObjectCommand";
+import { ListObjectsV2Command } from "../../src/commands/ListObjectsV2Command";
+import { S3Client } from "../../src/S3Client";
+
+/**
+ * Throws an expected exception that contains the serialized request.
+ */
+class EXPECTED_REQUEST_SERIALIZATION_ERROR extends Error {
+ constructor(readonly request: HttpRequest) {
+ super();
+ }
+}
+
+/**
+ * Throws an EXPECTED_REQUEST_SERIALIZATION_ERROR error before sending a
+ * request. The thrown exception contains the serialized request.
+ */
+class RequestSerializationTestHandler implements HttpHandler {
+ handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> {
+ return Promise.reject(new EXPECTED_REQUEST_SERIALIZATION_ERROR(request));
+ }
+ updateHttpClientConfig(key: never, value: never): void {}
+ httpHandlerConfigs() {
+ return {};
+ }
+}
+
+/**
+ * Returns a resolved Promise of the specified response contents.
+ */
+class ResponseDeserializationTestHandler implements HttpHandler {
+ isSuccess: boolean;
+ code: number;
+ headers: HeaderBag;
+ body: String;
+
+ constructor(isSuccess: boolean, code: number, headers?: HeaderBag, body?: String) {
+ this.isSuccess = isSuccess;
+ this.code = code;
+ if (headers === undefined) {
+ this.headers = {};
+ } else {
+ this.headers = headers;
+ }
+ if (body === undefined) {
+ body = "";
+ }
+ this.body = body;
+ }
+
+ handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{ response: HttpResponse }> {
+ return Promise.resolve({
+ response: new HttpResponse({
+ statusCode: this.code,
+ headers: this.headers,
+ body: Readable.from([this.body]),
+ }),
+ });
+ }
+ updateHttpClientConfig(key: never, value: never): void {}
+ httpHandlerConfigs() {
+ return {};
+ }
+}
+
+interface comparableParts {
+ [key: string]: string;
+}
+
+/**
+ * Generates a standard map of un-equal values given input parts.
+ */
+const compareParts = (expectedParts: comparableParts, generatedParts: comparableParts) => {
+ const unequalParts: any = {};
+ Object.keys(expectedParts).forEach((key) => {
+ if (generatedParts[key] === undefined) {
+ unequalParts[key] = { exp: expectedParts[key], gen: undefined };
+ } else if (!equivalentContents(expectedParts[key], generatedParts[key])) {
+ unequalParts[key] = { exp: expectedParts[key], gen: generatedParts[key] };
+ }
+ });
+
+ Object.keys(generatedParts).forEach((key) => {
+ if (expectedParts[key] === undefined) {
+ unequalParts[key] = { exp: undefined, gen: generatedParts[key] };
+ }
+ });
+
+ if (Object.keys(unequalParts).length !== 0) {
+ return unequalParts;
+ }
+ return undefined;
+};
+
+/**
+ * Compares all types for equivalent contents, doing nested
+ * equality checks based on non-`$metadata`
+ * properties that have defined values.
+ */
+const equivalentContents = (expected: any, generated: any): boolean => {
+ const localExpected = expected;
+
+ // Short circuit on equality.
+ if (localExpected == generated) {
+ return true;
+ }
+
+ // If a test fails with an issue in the below 6 lines, it's likely
+ // due to an issue in the nestedness or existence of the property
+ // being compared.
+ delete localExpected["$metadata"];
+ delete generated["$metadata"];
+ Object.keys(localExpected).forEach((key) => localExpected[key] === undefined && delete localExpected[key]);
+ Object.keys(generated).forEach((key) => generated[key] === undefined && delete generated[key]);
+
+ const expectedProperties = Object.getOwnPropertyNames(localExpected);
+ const generatedProperties = Object.getOwnPropertyNames(generated);
+
+ // Short circuit on different property counts.
+ if (expectedProperties.length != generatedProperties.length) {
+ return false;
+ }
+
+ // Compare properties directly.
+ for (let index = 0; index < expectedProperties.length; index++) {
+ const propertyName = expectedProperties[index];
+ if (!equivalentContents(localExpected[propertyName], generated[propertyName])) {
+ return false;
+ }
+ }
+
+ return true;
+};
+
+const clientParams = {
+ region: "us-west-2",
+ credentials: { accessKeyId: "key", secretAccessKey: "secret" },
+};
+
+/**
+ * A wrapper function that shadows `fail` from jest-jasmine2
+ * (jasmine2 was replaced with circus in > v27 as the default test runner)
+ */
+const fail = (error?: any): never => {
+ throw new Error(error);
+};
+
+/**
+ * S3 clients should escape special characters in Object Keys
+ * when the Object Key is used as a URI label binding.
+ *
+ */
+it("S3EscapeObjectKeyInUriLabel:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new DeleteObjectTaggingCommand({
+ Bucket: "mybucket",
+
+ Key: "my key.txt",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("DELETE");
+ expect(r.path).toBe("/my%20key.txt");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("tagging");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should preserve an Object Key representing a path
+ * when the Object Key is used as a URI label binding, but still
+ * escape special characters.
+ *
+ */
+it("S3EscapePathObjectKeyInUriLabel:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new DeleteObjectTaggingCommand({
+ Bucket: "mybucket",
+
+ Key: "foo/bar/my key.txt",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("DELETE");
+ expect(r.path).toBe("/foo/bar/my%20key.txt");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("tagging");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should use the @s3UnwrappedXmlOutput trait to determine
+ * that the response shape is not wrapped in a restxml operation-level XML node.
+ *
+ */
+it("GetBucketLocationUnwrappedOutput:Response", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ requestHandler: new ResponseDeserializationTestHandler(
+ true,
+ 200,
+ undefined,
+ `
+ us-west-2`
+ ),
+ });
+
+ const params: any = {};
+ const command = new GetBucketLocationCommand(params);
+
+ let r: any;
+ try {
+ r = await client.send(command);
+ } catch (err) {
+ fail("Expected a valid response to be returned, got " + err);
+ return;
+ }
+ expect(r["$metadata"].httpStatusCode).toBe(200);
+ const paramsToValidate: any = [
+ {
+ LocationConstraint: "us-west-2",
+ },
+ ][0];
+ Object.keys(paramsToValidate).forEach((param) => {
+ expect(r[param]).toBeDefined();
+ expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true);
+ });
+});
+
+/**
+ * S3 clients should not remove dot segments from request paths.
+ *
+ */
+it("S3PreservesLeadingDotSegmentInUriLabel:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new GetObjectCommand({
+ Bucket: "mybucket",
+
+ Key: "../key.txt",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/../key.txt");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("tagging");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should not remove dot segments from request paths.
+ *
+ */
+it("S3PreservesEmbeddedDotSegmentInUriLabel:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new GetObjectCommand({
+ Bucket: "mybucket",
+
+ Key: "foo/../key.txt",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("foo/../key.txt");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("tagging");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should map the default addressing style to virtual host.
+ */
+it("S3DefaultAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should support the explicit virtual host addressing style.
+ */
+it("S3VirtualHostAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should support the explicit path addressing style.
+ */
+it("S3PathAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/mybucket");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should support the explicit virtual host
+ * addressing style with Dualstack.
+ */
+it("S3VirtualHostDualstackAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.dualstack.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should support the explicit virtual host
+ * addressing style with S3 Accelerate.
+ */
+it("S3VirtualHostAccelerateAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3-accelerate.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should support the explicit virtual host
+ * addressing style with Dualstack and S3 Accelerate.
+ */
+it("S3VirtualHostDualstackAccelerateAddressing:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3-accelerate.dualstack.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 clients should resolve to the addressing style of the
+ * operation if defined on both the client and operation.
+ */
+it("S3OperationAddressingPreferred:Request", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ endpoint: "https://s3.us-west-2.amazonaws.com",
+ requestHandler: new RequestSerializationTestHandler(),
+ });
+
+ const command = new ListObjectsV2Command({
+ Bucket: "mybucket",
+ } as any);
+ try {
+ await client.send(command);
+ fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
+ return;
+ } catch (err) {
+ if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
+ fail(err);
+ return;
+ }
+ const r = err.request;
+ expect(r.method).toBe("GET");
+ expect(r.path).toBe("/");
+
+ const queryString = buildQueryString(r.query);
+ expect(queryString).toContain("list-type=2");
+
+ expect(r.headers["host"]).toBeDefined();
+ expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
+
+ expect(r.body).toBeFalsy();
+ }
+});
+
+/**
+ * S3 operations return Error XML nodes unwrapped by
+ * the ErrorResponse XML node.
+ *
+ */
+it("S3OperationNoErrorWrappingResponse:Error:ListObjectsV2", async () => {
+ const client = new S3Client({
+ ...clientParams,
+ requestHandler: new ResponseDeserializationTestHandler(
+ false,
+ 400,
+ {
+ "content-type": "application/xml",
+ },
+ `
+
+ Sender
+ NoSuchBucket
+ `
+ ),
+ });
+
+ const params: any = {};
+ const command = new ListObjectsV2Command(params);
+
+ try {
+ await client.send(command);
+ } catch (err) {
+ if (err.name !== "NoSuchBucket") {
+ console.log(err);
+ fail(`Expected a NoSuchBucket to be thrown, got ${err.name} instead`);
+ return;
+ }
+ const r: any = err;
+ expect(r["$metadata"].httpStatusCode).toBe(400);
+ return;
+ }
+ fail("Expected an exception to be thrown from response");
+});
diff --git a/private/aws-protocoltests-restxml-s3/tsconfig.cjs.json b/private/aws-protocoltests-restxml-s3/tsconfig.cjs.json
new file mode 100644
index 000000000000..3567d85ba846
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/tsconfig.cjs.json
@@ -0,0 +1,6 @@
+{
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "outDir": "dist-cjs"
+ }
+}
diff --git a/private/aws-protocoltests-restxml-s3/tsconfig.es.json b/private/aws-protocoltests-restxml-s3/tsconfig.es.json
new file mode 100644
index 000000000000..809f57bde65e
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/tsconfig.es.json
@@ -0,0 +1,8 @@
+{
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "lib": ["dom"],
+ "module": "esnext",
+ "outDir": "dist-es"
+ }
+}
diff --git a/private/aws-protocoltests-restxml-s3/tsconfig.json b/private/aws-protocoltests-restxml-s3/tsconfig.json
new file mode 100644
index 000000000000..e7f5ec56b742
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "extends": "@tsconfig/node16/tsconfig.json",
+ "compilerOptions": {
+ "downlevelIteration": true,
+ "importHelpers": true,
+ "incremental": true,
+ "removeComments": true,
+ "resolveJsonModule": true,
+ "rootDir": "src",
+ "useUnknownInCatchVariables": false
+ },
+ "exclude": ["test/"]
+}
diff --git a/private/aws-protocoltests-restxml-s3/tsconfig.types.json b/private/aws-protocoltests-restxml-s3/tsconfig.types.json
new file mode 100644
index 000000000000..4c3dfa7b3d25
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/tsconfig.types.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "removeComments": false,
+ "declaration": true,
+ "declarationDir": "dist-types",
+ "emitDeclarationOnly": true
+ },
+ "exclude": ["test/**/*", "dist-types/**/*"]
+}
From 27d17a23fe1ee8cef172076514da5380c3a2d7a8 Mon Sep 17 00:00:00 2001
From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com>
Date: Fri, 7 Jun 2024 19:29:05 +0000
Subject: [PATCH 3/6] chore: add jest config and script
---
private/aws-protocoltests-restxml-s3/jest.config.js | 5 +++++
private/aws-protocoltests-restxml-s3/package.json | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 private/aws-protocoltests-restxml-s3/jest.config.js
diff --git a/private/aws-protocoltests-restxml-s3/jest.config.js b/private/aws-protocoltests-restxml-s3/jest.config.js
new file mode 100644
index 000000000000..a8d1c2e49912
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/jest.config.js
@@ -0,0 +1,5 @@
+const base = require("../../jest.config.base.js");
+
+module.exports = {
+ ...base,
+};
diff --git a/private/aws-protocoltests-restxml-s3/package.json b/private/aws-protocoltests-restxml-s3/package.json
index b24f7a9ae7c6..fc99bae327c8 100644
--- a/private/aws-protocoltests-restxml-s3/package.json
+++ b/private/aws-protocoltests-restxml-s3/package.json
@@ -9,7 +9,8 @@
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
"build:types": "tsc -p tsconfig.types.json",
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
- "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0"
+ "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
+ "test": "jest --coverage --passWithNoTests"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
From b88ce57ac973941b9487e4e74556fafb200d9177 Mon Sep 17 00:00:00 2001
From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com>
Date: Tue, 2 Jul 2024 17:30:20 +0000
Subject: [PATCH 4/6] test(protocoltests): update S3 Client as per
smithy@1.50.0
---
.../aws-protocoltests-restxml-s3/README.md | 56 +++++++++++++++++++
.../aws-protocoltests-restxml-s3/package.json | 49 ++++++++--------
.../test/functional/restxml.spec.ts | 8 +--
3 files changed, 81 insertions(+), 32 deletions(-)
diff --git a/private/aws-protocoltests-restxml-s3/README.md b/private/aws-protocoltests-restxml-s3/README.md
index 0324883c8da8..a3afabad6ac6 100644
--- a/private/aws-protocoltests-restxml-s3/README.md
+++ b/private/aws-protocoltests-restxml-s3/README.md
@@ -400,6 +400,14 @@ XmlTimestamps
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/XmlTimestampsCommandOutput/)
+
+
+
+ContentTypeParameters
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandOutput/)
+
@@ -536,6 +544,14 @@ SparseNullsOperation
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/SparseNullsOperationCommandOutput/)
+
+
+
+ContentTypeParameters
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandOutput/)
+
@@ -944,6 +960,14 @@ ConstantQueryString
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ConstantQueryStringCommandOutput/)
+
+
+
+ContentTypeParameters
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandOutput/)
+
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OmitsSerializingEmptyListsCommandOutput/)
+
+
+
+OperationWithDefaults
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OperationWithDefaultsCommandOutput/)
+
+
+
+
+OperationWithNestedStructure
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/OperationWithNestedStructureCommandOutput/)
+
@@ -1664,6 +1704,14 @@ TestBodyStructure
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/TestBodyStructureCommandOutput/)
+
+
+
+TestNoInputNoPayload
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/TestNoInputNoPayloadCommandOutput/)
+
@@ -1832,6 +1880,14 @@ ConstantQueryString
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ConstantQueryStringCommandOutput/)
+
+
+
+ContentTypeParameters
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Interface/ContentTypeParametersCommandOutput/)
+
diff --git a/private/aws-protocoltests-restxml-s3/package.json b/private/aws-protocoltests-restxml-s3/package.json
index fc99bae327c8..0663819c6674 100644
--- a/private/aws-protocoltests-restxml-s3/package.json
+++ b/private/aws-protocoltests-restxml-s3/package.json
@@ -9,16 +9,15 @@
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
"build:types": "tsc -p tsconfig.types.json",
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
- "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
- "test": "jest --coverage --passWithNoTests"
+ "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
"module": "./dist-es/index.js",
"sideEffects": false,
"dependencies": {
- "@aws-crypto/sha256-browser": "3.0.0",
- "@aws-crypto/sha256-js": "3.0.0",
+ "@aws-crypto/sha256-browser": "5.2.0",
+ "@aws-crypto/sha256-js": "5.2.0",
"@aws-sdk/client-sso-oidc": "*",
"@aws-sdk/client-sts": "*",
"@aws-sdk/core": "*",
@@ -36,30 +35,30 @@
"@aws-sdk/util-user-agent-browser": "*",
"@aws-sdk/util-user-agent-node": "*",
"@aws-sdk/xml-builder": "*",
- "@smithy/config-resolver": "^3.0.1",
- "@smithy/core": "^2.2.0",
- "@smithy/fetch-http-handler": "^3.0.1",
- "@smithy/hash-node": "^3.0.0",
- "@smithy/invalid-dependency": "^3.0.0",
- "@smithy/middleware-content-length": "^3.0.0",
- "@smithy/middleware-endpoint": "^3.0.1",
- "@smithy/middleware-retry": "^3.0.3",
- "@smithy/middleware-serde": "^3.0.0",
- "@smithy/middleware-stack": "^3.0.0",
- "@smithy/node-config-provider": "^3.1.0",
- "@smithy/node-http-handler": "^3.0.0",
- "@smithy/protocol-http": "^4.0.0",
- "@smithy/querystring-builder": "^3.0.0",
- "@smithy/smithy-client": "^3.1.1",
- "@smithy/types": "^3.0.0",
- "@smithy/url-parser": "^3.0.0",
+ "@smithy/config-resolver": "^3.0.4",
+ "@smithy/core": "^2.2.4",
+ "@smithy/fetch-http-handler": "^3.2.0",
+ "@smithy/hash-node": "^3.0.3",
+ "@smithy/invalid-dependency": "^3.0.3",
+ "@smithy/middleware-content-length": "^3.0.3",
+ "@smithy/middleware-endpoint": "^3.0.4",
+ "@smithy/middleware-retry": "^3.0.7",
+ "@smithy/middleware-serde": "^3.0.3",
+ "@smithy/middleware-stack": "^3.0.3",
+ "@smithy/node-config-provider": "^3.1.3",
+ "@smithy/node-http-handler": "^3.1.1",
+ "@smithy/protocol-http": "^4.0.3",
+ "@smithy/querystring-builder": "^3.0.3",
+ "@smithy/smithy-client": "^3.1.5",
+ "@smithy/types": "^3.3.0",
+ "@smithy/url-parser": "^3.0.3",
"@smithy/util-base64": "^3.0.0",
"@smithy/util-body-length-browser": "^3.0.0",
"@smithy/util-body-length-node": "^3.0.0",
- "@smithy/util-defaults-mode-browser": "^3.0.3",
- "@smithy/util-defaults-mode-node": "^3.0.3",
- "@smithy/util-middleware": "^3.0.0",
- "@smithy/util-retry": "^3.0.0",
+ "@smithy/util-defaults-mode-browser": "^3.0.7",
+ "@smithy/util-defaults-mode-node": "^3.0.7",
+ "@smithy/util-middleware": "^3.0.3",
+ "@smithy/util-retry": "^3.0.3",
"@smithy/util-utf8": "^3.0.0",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
diff --git a/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts b/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
index dbe0345d9caa..bb49d0561752 100644
--- a/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
+++ b/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
@@ -302,9 +302,6 @@ it("S3PreservesLeadingDotSegmentInUriLabel:Request", async () => {
expect(r.method).toBe("GET");
expect(r.path).toBe("/../key.txt");
- const queryString = buildQueryString(r.query);
- expect(queryString).toContain("tagging");
-
expect(r.headers["host"]).toBeDefined();
expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
@@ -339,10 +336,7 @@ it("S3PreservesEmbeddedDotSegmentInUriLabel:Request", async () => {
}
const r = err.request;
expect(r.method).toBe("GET");
- expect(r.path).toBe("foo/../key.txt");
-
- const queryString = buildQueryString(r.query);
- expect(queryString).toContain("tagging");
+ expect(r.path).toBe("/foo/../key.txt");
expect(r.headers["host"]).toBeDefined();
expect(r.headers["host"]).toBe("mybucket.s3.us-west-2.amazonaws.com");
From 1001848bf4cb9e7e61f2c188e9a4690ed28d63d3 Mon Sep 17 00:00:00 2001
From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com>
Date: Tue, 9 Jul 2024 15:24:08 +0000
Subject: [PATCH 5/6] chore(codegen): disable experimentalIdentityAndAuth for
aws-protocoltests-restxml-s3
---
codegen/protocol-test-codegen/smithy-build.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/codegen/protocol-test-codegen/smithy-build.json b/codegen/protocol-test-codegen/smithy-build.json
index 5d742a0acdbb..c506a688d568 100644
--- a/codegen/protocol-test-codegen/smithy-build.json
+++ b/codegen/protocol-test-codegen/smithy-build.json
@@ -270,7 +270,7 @@
"license": "Apache-2.0"
},
"private": true,
- "experimentalIdentityAndAuth": true
+ "experimentalIdentityAndAuth": false
}
}
}
From d1206c3d9f60637dff53d905c8223ac16eaa6c7c Mon Sep 17 00:00:00 2001
From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com>
Date: Tue, 9 Jul 2024 15:29:30 +0000
Subject: [PATCH 6/6] chore(aws-protocoltests-restxml-s3): disable
experimentalIdentityAndAuth
---
.../aws-protocoltests-restxml-s3/package.json | 3 +-
.../src/S3Client.ts | 60 ++--
.../auth/httpAuthExtensionConfiguration.ts | 72 ----
.../src/auth/httpAuthSchemeProvider.ts | 314 ------------------
.../src/extensionConfiguration.ts | 5 +-
.../src/runtimeConfig.shared.ts | 16 -
.../src/runtimeExtensions.ts | 3 -
7 files changed, 23 insertions(+), 450 deletions(-)
delete mode 100644 private/aws-protocoltests-restxml-s3/src/auth/httpAuthExtensionConfiguration.ts
delete mode 100644 private/aws-protocoltests-restxml-s3/src/auth/httpAuthSchemeProvider.ts
diff --git a/private/aws-protocoltests-restxml-s3/package.json b/private/aws-protocoltests-restxml-s3/package.json
index 0663819c6674..9db67597f4c6 100644
--- a/private/aws-protocoltests-restxml-s3/package.json
+++ b/private/aws-protocoltests-restxml-s3/package.json
@@ -28,6 +28,7 @@
"@aws-sdk/middleware-logger": "*",
"@aws-sdk/middleware-recursion-detection": "*",
"@aws-sdk/middleware-sdk-s3": "*",
+ "@aws-sdk/middleware-signing": "*",
"@aws-sdk/middleware-user-agent": "*",
"@aws-sdk/region-config-resolver": "*",
"@aws-sdk/signature-v4-multi-region": "*",
@@ -41,7 +42,6 @@
"@smithy/hash-node": "^3.0.3",
"@smithy/invalid-dependency": "^3.0.3",
"@smithy/middleware-content-length": "^3.0.3",
- "@smithy/middleware-endpoint": "^3.0.4",
"@smithy/middleware-retry": "^3.0.7",
"@smithy/middleware-serde": "^3.0.3",
"@smithy/middleware-stack": "^3.0.3",
@@ -57,7 +57,6 @@
"@smithy/util-body-length-node": "^3.0.0",
"@smithy/util-defaults-mode-browser": "^3.0.7",
"@smithy/util-defaults-mode-node": "^3.0.7",
- "@smithy/util-middleware": "^3.0.3",
"@smithy/util-retry": "^3.0.3",
"@smithy/util-utf8": "^3.0.0",
"tslib": "^2.6.2",
diff --git a/private/aws-protocoltests-restxml-s3/src/S3Client.ts b/private/aws-protocoltests-restxml-s3/src/S3Client.ts
index 05598dfaa29a..6a1dcb92c79a 100644
--- a/private/aws-protocoltests-restxml-s3/src/S3Client.ts
+++ b/private/aws-protocoltests-restxml-s3/src/S3Client.ts
@@ -14,12 +14,19 @@ import {
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
import { getRegionRedirectMiddlewarePlugin, getValidateBucketNamePlugin } from "@aws-sdk/middleware-sdk-s3";
+import {
+ AwsAuthInputConfig,
+ AwsAuthResolvedConfig,
+ getAwsAuthPlugin,
+ resolveAwsAuthConfig,
+} from "@aws-sdk/middleware-signing";
import {
getUserAgentPlugin,
resolveUserAgentConfig,
UserAgentInputConfig,
UserAgentResolvedConfig,
} from "@aws-sdk/middleware-user-agent";
+import { Credentials as __Credentials } from "@aws-sdk/types";
import {
EndpointsInputConfig,
EndpointsResolvedConfig,
@@ -28,7 +35,6 @@ import {
resolveEndpointsConfig,
resolveRegionConfig,
} from "@smithy/config-resolver";
-import { DefaultIdentityProviderConfig, getHttpAuthSchemePlugin, getHttpSigningPlugin } from "@smithy/core";
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
import { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
@@ -39,7 +45,6 @@ import {
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@smithy/smithy-client";
import {
- AwsCredentialIdentityProvider,
BodyLengthCalculator as __BodyLengthCalculator,
CheckOptionalClientConfig as __CheckOptionalClientConfig,
ChecksumConstructor as __ChecksumConstructor,
@@ -56,12 +61,6 @@ import {
UserAgent as __UserAgent,
} from "@smithy/types";
-import {
- defaultS3HttpAuthSchemeParametersProvider,
- HttpAuthSchemeInputConfig,
- HttpAuthSchemeResolvedConfig,
- resolveHttpAuthSchemeConfig,
-} from "./auth/httpAuthSchemeProvider";
import {
DeleteObjectTaggingCommandInput,
DeleteObjectTaggingCommandOutput,
@@ -183,6 +182,12 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider;
+ /**
+ * Default credentials provider; Not available in browser runtime.
+ * @internal
+ */
+ credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
+
/**
* Fetch related hostname, signing name or signing region with given region.
* @internal
@@ -204,13 +209,6 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
- /**
- * Default credentials provider; Not available in browser runtime.
- * @deprecated
- * @internal
- */
- credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider;
-
/**
* Value for how many times a request will be made at most in case of retry.
*/
@@ -248,9 +246,9 @@ export type S3ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOpti
EndpointsInputConfig &
RetryInputConfig &
HostHeaderInputConfig &
+ AwsAuthInputConfig &
BucketEndpointInputConfig &
- UserAgentInputConfig &
- HttpAuthSchemeInputConfig;
+ UserAgentInputConfig;
/**
* @public
*
@@ -268,9 +266,9 @@ export type S3ClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHan
EndpointsResolvedConfig &
RetryResolvedConfig &
HostHeaderResolvedConfig &
+ AwsAuthResolvedConfig &
BucketEndpointResolvedConfig &
- UserAgentResolvedConfig &
- HttpAuthSchemeResolvedConfig;
+ UserAgentResolvedConfig;
/**
* @public
*
@@ -298,9 +296,9 @@ export class S3Client extends __Client<
const _config_2 = resolveEndpointsConfig(_config_1);
const _config_3 = resolveRetryConfig(_config_2);
const _config_4 = resolveHostHeaderConfig(_config_3);
- const _config_5 = resolveBucketEndpointConfig(_config_4);
- const _config_6 = resolveUserAgentConfig(_config_5);
- const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
+ const _config_5 = resolveAwsAuthConfig(_config_4);
+ const _config_6 = resolveBucketEndpointConfig(_config_5);
+ const _config_7 = resolveUserAgentConfig(_config_6);
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
super(_config_8);
this.config = _config_8;
@@ -309,17 +307,11 @@ export class S3Client extends __Client<
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
+ this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getValidateBucketNamePlugin(this.config));
this.middlewareStack.use(getAddExpectContinuePlugin(this.config));
this.middlewareStack.use(getRegionRedirectMiddlewarePlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
- this.middlewareStack.use(
- getHttpAuthSchemePlugin(this.config, {
- httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
- identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
- })
- );
- this.middlewareStack.use(getHttpSigningPlugin(this.config));
}
/**
@@ -330,14 +322,4 @@ export class S3Client extends __Client<
destroy(): void {
super.destroy();
}
- private getDefaultHttpAuthSchemeParametersProvider() {
- return defaultS3HttpAuthSchemeParametersProvider;
- }
- private getIdentityProviderConfigProvider() {
- return async (config: S3ClientResolvedConfig) =>
- new DefaultIdentityProviderConfig({
- "aws.auth#sigv4": config.credentials,
- "aws.auth#sigv4a": config.credentials,
- });
- }
}
diff --git a/private/aws-protocoltests-restxml-s3/src/auth/httpAuthExtensionConfiguration.ts b/private/aws-protocoltests-restxml-s3/src/auth/httpAuthExtensionConfiguration.ts
deleted file mode 100644
index 2699fc3c838b..000000000000
--- a/private/aws-protocoltests-restxml-s3/src/auth/httpAuthExtensionConfiguration.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-// smithy-typescript generated code
-import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types";
-
-import { S3HttpAuthSchemeProvider } from "./httpAuthSchemeProvider";
-
-/**
- * @internal
- */
-export interface HttpAuthExtensionConfiguration {
- setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void;
- httpAuthSchemes(): HttpAuthScheme[];
- setHttpAuthSchemeProvider(httpAuthSchemeProvider: S3HttpAuthSchemeProvider): void;
- httpAuthSchemeProvider(): S3HttpAuthSchemeProvider;
- setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void;
- credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined;
-}
-
-/**
- * @internal
- */
-export type HttpAuthRuntimeConfig = Partial<{
- httpAuthSchemes: HttpAuthScheme[];
- httpAuthSchemeProvider: S3HttpAuthSchemeProvider;
- credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
-}>;
-
-/**
- * @internal
- */
-export const getHttpAuthExtensionConfiguration = (
- runtimeConfig: HttpAuthRuntimeConfig
-): HttpAuthExtensionConfiguration => {
- const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!;
- let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!;
- let _credentials = runtimeConfig.credentials;
- return {
- setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void {
- const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
- if (index === -1) {
- _httpAuthSchemes.push(httpAuthScheme);
- } else {
- _httpAuthSchemes.splice(index, 1, httpAuthScheme);
- }
- },
- httpAuthSchemes(): HttpAuthScheme[] {
- return _httpAuthSchemes;
- },
- setHttpAuthSchemeProvider(httpAuthSchemeProvider: S3HttpAuthSchemeProvider): void {
- _httpAuthSchemeProvider = httpAuthSchemeProvider;
- },
- httpAuthSchemeProvider(): S3HttpAuthSchemeProvider {
- return _httpAuthSchemeProvider;
- },
- setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void {
- _credentials = credentials;
- },
- credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined {
- return _credentials;
- },
- };
-};
-
-/**
- * @internal
- */
-export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => {
- return {
- httpAuthSchemes: config.httpAuthSchemes(),
- httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
- credentials: config.credentials(),
- };
-};
diff --git a/private/aws-protocoltests-restxml-s3/src/auth/httpAuthSchemeProvider.ts b/private/aws-protocoltests-restxml-s3/src/auth/httpAuthSchemeProvider.ts
deleted file mode 100644
index a5721a9151f4..000000000000
--- a/private/aws-protocoltests-restxml-s3/src/auth/httpAuthSchemeProvider.ts
+++ /dev/null
@@ -1,314 +0,0 @@
-// smithy-typescript generated code
-import {
- AwsSdkSigV4AuthInputConfig,
- AwsSdkSigV4AuthResolvedConfig,
- AwsSdkSigV4PreviouslyResolved,
- resolveAwsSdkSigV4Config,
-} from "@aws-sdk/core";
-import { EndpointParameterInstructions, resolveParams } from "@smithy/middleware-endpoint";
-import {
- EndpointV2,
- HandlerExecutionContext,
- HttpAuthOption,
- HttpAuthScheme,
- HttpAuthSchemeId,
- HttpAuthSchemeParameters,
- HttpAuthSchemeParametersProvider,
- HttpAuthSchemeProvider,
- Logger,
-} from "@smithy/types";
-import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
-
-import { EndpointParameters } from "../endpoint/EndpointParameters";
-import { defaultEndpointResolver } from "../endpoint/endpointResolver";
-import { S3ClientConfig, S3ClientResolvedConfig } from "../S3Client";
-
-/**
- * @internal
- */
-interface _S3HttpAuthSchemeParameters extends HttpAuthSchemeParameters {
- region?: string;
-}
-
-/**
- * @internal
- */
-export interface S3HttpAuthSchemeParameters extends _S3HttpAuthSchemeParameters, EndpointParameters {
- region?: string;
-}
-
-/**
- * @internal
- */
-export interface S3HttpAuthSchemeParametersProvider
- extends HttpAuthSchemeParametersProvider<
- S3ClientResolvedConfig,
- HandlerExecutionContext,
- S3HttpAuthSchemeParameters,
- object
- > {}
-
-/**
- * @internal
- */
-interface EndpointRuleSetSmithyContext {
- endpointRuleSet?: {
- getEndpointParameterInstructions?: () => EndpointParameterInstructions;
- };
-}
-/**
- * @internal
- */
-interface EndpointRuleSetHttpAuthSchemeParametersProvider<
- TConfig extends object,
- TContext extends HandlerExecutionContext,
- TParameters extends HttpAuthSchemeParameters & EndpointParameters,
- TInput extends object
-> extends HttpAuthSchemeParametersProvider {}
-/**
- * @internal
- */
-const createEndpointRuleSetHttpAuthSchemeParametersProvider =
- <
- TConfig extends object,
- TContext extends HandlerExecutionContext,
- THttpAuthSchemeParameters extends HttpAuthSchemeParameters,
- TEndpointParameters extends EndpointParameters,
- TParameters extends THttpAuthSchemeParameters & TEndpointParameters,
- TInput extends object
- >(
- defaultHttpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<
- TConfig,
- TContext,
- THttpAuthSchemeParameters,
- TInput
- >
- ): EndpointRuleSetHttpAuthSchemeParametersProvider<
- TConfig,
- TContext,
- THttpAuthSchemeParameters & TEndpointParameters,
- TInput
- > =>
- async (config: TConfig, context: TContext, input: TInput): Promise => {
- if (!input) {
- throw new Error(`Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\``);
- }
- const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
- const instructionsFn = (getSmithyContext(context) as EndpointRuleSetSmithyContext)?.endpointRuleSet
- ?.getEndpointParameterInstructions;
- if (!instructionsFn) {
- throw new Error(`getEndpointParameterInstructions() is not defined on \`${context.commandName!}\``);
- }
- const endpointParameters = await resolveParams(
- input as Record,
- { getEndpointParameterInstructions: instructionsFn! },
- config as Record
- );
- return Object.assign(defaultParameters, endpointParameters) as TParameters;
- };
-/**
- * @internal
- */
-const _defaultS3HttpAuthSchemeParametersProvider = async (
- config: S3ClientResolvedConfig,
- context: HandlerExecutionContext,
- input: object
-): Promise<_S3HttpAuthSchemeParameters> => {
- return {
- operation: getSmithyContext(context).operation as string,
- region:
- (await normalizeProvider(config.region)()) ||
- (() => {
- throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
- })(),
- };
-};
-/**
- * @internal
- */
-export const defaultS3HttpAuthSchemeParametersProvider: S3HttpAuthSchemeParametersProvider =
- createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultS3HttpAuthSchemeParametersProvider);
-
-function createAwsAuthSigv4HttpAuthOption(authParameters: S3HttpAuthSchemeParameters): HttpAuthOption {
- return {
- schemeId: "aws.auth#sigv4",
- signingProperties: {
- name: "s3",
- region: authParameters.region,
- },
- propertiesExtractor: (config: S3ClientConfig, context) => ({
- /**
- * @internal
- */
- signingProperties: {
- config,
- context,
- },
- }),
- };
-}
-
-function createAwsAuthSigv4aHttpAuthOption(authParameters: S3HttpAuthSchemeParameters): HttpAuthOption {
- return {
- schemeId: "aws.auth#sigv4a",
- signingProperties: {
- name: "s3",
- region: authParameters.region,
- },
- propertiesExtractor: (config: S3ClientConfig, context) => ({
- /**
- * @internal
- */
- signingProperties: {
- config,
- context,
- },
- }),
- };
-}
-
-/**
- * @internal
- */
-interface _S3HttpAuthSchemeProvider extends HttpAuthSchemeProvider {}
-
-/**
- * @internal
- */
-export interface S3HttpAuthSchemeProvider extends HttpAuthSchemeProvider {}
-
-/**
- * @internal
- */
-interface EndpointRuleSetHttpAuthSchemeProvider<
- EndpointParametersT extends EndpointParameters,
- HttpAuthSchemeParametersT extends HttpAuthSchemeParameters
-> extends HttpAuthSchemeProvider {}
-/**
- * @internal
- */
-interface DefaultEndpointResolver {
- (params: EndpointParametersT, context?: { logger?: Logger }): EndpointV2;
-}
-/**
- * @internal
- */
-const createEndpointRuleSetHttpAuthSchemeProvider = <
- EndpointParametersT extends EndpointParameters,
- HttpAuthSchemeParametersT extends HttpAuthSchemeParameters
->(
- defaultEndpointResolver: DefaultEndpointResolver,
- defaultHttpAuthSchemeResolver: HttpAuthSchemeProvider,
- createHttpAuthOptionFunctions: Record<
- HttpAuthSchemeId,
- (authParameters: EndpointParametersT & HttpAuthSchemeParametersT) => HttpAuthOption
- >
-): EndpointRuleSetHttpAuthSchemeProvider => {
- const endpointRuleSetHttpAuthSchemeProvider: EndpointRuleSetHttpAuthSchemeProvider<
- EndpointParametersT,
- HttpAuthSchemeParametersT
- > = (authParameters) => {
- const endpoint: EndpointV2 = defaultEndpointResolver(authParameters);
- const authSchemes = endpoint.properties?.authSchemes;
- if (!authSchemes) {
- return defaultHttpAuthSchemeResolver(authParameters);
- }
- const options: HttpAuthOption[] = [];
- for (const scheme of authSchemes) {
- const { name: resolvedName, properties = {}, ...rest } = scheme;
- const name = resolvedName.toLowerCase();
- if (resolvedName !== name) {
- console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${resolvedName}\` to \`${name}\``);
- }
- let schemeId;
- if (name === "sigv4a" || name === "sigv4-s3express") {
- schemeId = "aws.auth#sigv4a";
- } else if (name.startsWith("sigv4")) {
- schemeId = "aws.auth#sigv4";
- } else {
- throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${name}\``);
- }
- const createOption = createHttpAuthOptionFunctions[schemeId];
- if (!createOption) {
- throw new Error(`Could not find HttpAuthOption create function for \`${schemeId}\``);
- }
- const option = createOption(authParameters);
- option.schemeId = schemeId;
- option.signingProperties = { ...(option.signingProperties || {}), ...rest, ...properties };
- options.push(option);
- }
- return options;
- };
-
- return endpointRuleSetHttpAuthSchemeProvider;
-};
-/**
- * @internal
- */
-const _defaultS3HttpAuthSchemeProvider: _S3HttpAuthSchemeProvider = (authParameters) => {
- const options: HttpAuthOption[] = [];
- switch (authParameters.operation) {
- default: {
- options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
- options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
- }
- }
- return options;
-};
-/**
- * @internal
- */
-export const defaultS3HttpAuthSchemeProvider: S3HttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(
- defaultEndpointResolver,
- _defaultS3HttpAuthSchemeProvider,
- {
- "aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
- "aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
- }
-);
-
-/**
- * @internal
- */
-export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig {
- /**
- * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
- * @internal
- */
- httpAuthSchemes?: HttpAuthScheme[];
-
- /**
- * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
- * @internal
- */
- httpAuthSchemeProvider?: S3HttpAuthSchemeProvider;
-}
-
-/**
- * @internal
- */
-export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {
- /**
- * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
- * @internal
- */
- readonly httpAuthSchemes: HttpAuthScheme[];
-
- /**
- * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
- * @internal
- */
- readonly httpAuthSchemeProvider: S3HttpAuthSchemeProvider;
-}
-
-/**
- * @internal
- */
-export const resolveHttpAuthSchemeConfig = (
- config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved
-): T & HttpAuthSchemeResolvedConfig => {
- const config_0 = resolveAwsSdkSigV4Config(config);
- return {
- ...config_0,
- } as T & HttpAuthSchemeResolvedConfig;
-};
diff --git a/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts b/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
index 5acc0f2effcc..7f8cdb6615a8 100644
--- a/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
+++ b/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
@@ -3,13 +3,10 @@ import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
import { DefaultExtensionConfiguration } from "@smithy/types";
-import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration";
-
/**
* @internal
*/
export interface S3ExtensionConfiguration
extends HttpHandlerExtensionConfiguration,
DefaultExtensionConfiguration,
- AwsRegionExtensionConfiguration,
- HttpAuthExtensionConfiguration {}
+ AwsRegionExtensionConfiguration {}
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
index 82451633baa6..45ace3236c9f 100644
--- a/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
@@ -1,13 +1,10 @@
// smithy-typescript generated code
-import { AwsSdkSigV4Signer } from "@aws-sdk/core";
import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
import { NoOpLogger } from "@smithy/smithy-client";
-import { IdentityProviderConfig } from "@smithy/types";
import { parseUrl } from "@smithy/url-parser";
import { fromBase64, toBase64 } from "@smithy/util-base64";
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
-import { defaultS3HttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
import { defaultRegionInfoProvider } from "./endpoints";
import { S3ClientConfig } from "./S3Client";
@@ -21,19 +18,6 @@ export const getRuntimeConfig = (config: S3ClientConfig) => {
base64Encoder: config?.base64Encoder ?? toBase64,
disableHostPrefix: config?.disableHostPrefix ?? false,
extensions: config?.extensions ?? [],
- httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultS3HttpAuthSchemeProvider,
- httpAuthSchemes: config?.httpAuthSchemes ?? [
- {
- schemeId: "aws.auth#sigv4",
- identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"),
- signer: new AwsSdkSigV4Signer(),
- },
- {
- schemeId: "aws.auth#sigv4a",
- identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4a"),
- signer: new AwsSdkSigV4Signer(),
- },
- ],
logger: config?.logger ?? new NoOpLogger(),
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
serviceId: config?.serviceId ?? "S3",
diff --git a/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts b/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
index 9d8607cc18ec..454a50e80734 100644
--- a/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
@@ -6,7 +6,6 @@ import {
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
-import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
import { S3ExtensionConfiguration } from "./extensionConfiguration";
/**
@@ -33,7 +32,6 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime
...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
- ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
};
extensions.forEach((extension) => extension.configure(extensionConfiguration));
@@ -43,6 +41,5 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
...resolveDefaultRuntimeConfig(extensionConfiguration),
...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
- ...resolveHttpAuthRuntimeConfig(extensionConfiguration),
};
};