) {
+ const _config_0 = __getRuntimeConfig(configuration || {});
+ const _config_1 = resolveRegionConfig(_config_0);
+ const _config_2 = resolveEndpointsConfig(_config_1);
+ const _config_3 = resolveRetryConfig(_config_2);
+ const _config_4 = resolveHostHeaderConfig(_config_3);
+ 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;
+ this.middlewareStack.use(getRetryPlugin(this.config));
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
+ 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));
+ }
+
+ /**
+ * Destroy underlying resources, like sockets. It's usually not necessary to do this.
+ * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
+ * Otherwise, sockets might stay open for quite a long time before the server terminates them.
+ */
+ destroy(): void {
+ super.destroy();
+ }
+}
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 0000000000000..8930ea5fb0a3d
--- /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 0000000000000..d44e895f94dbc
--- /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 0000000000000..57afa9e935b7c
--- /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 0000000000000..3d18f53a67af1
--- /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 0000000000000..4c7207866971d
--- /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 0000000000000..811908c7ad7fa
--- /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 0000000000000..7f8cdb6615a81
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/extensionConfiguration.ts
@@ -0,0 +1,12 @@
+// smithy-typescript generated code
+import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
+import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
+import { DefaultExtensionConfiguration } from "@smithy/types";
+
+/**
+ * @internal
+ */
+export interface S3ExtensionConfiguration
+ extends HttpHandlerExtensionConfiguration,
+ DefaultExtensionConfiguration,
+ AwsRegionExtensionConfiguration {}
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 0000000000000..20be7e038683e
--- /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 0000000000000..14dd9550605b7
--- /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 0000000000000..9eaceb12865f8
--- /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 0000000000000..9ebb10dc31c51
--- /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 0000000000000..e86088394a79f
--- /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 0000000000000..75a6827f4f538
--- /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 0000000000000..df6d3be1b3ab1
--- /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 0000000000000..45e4065a53219
--- /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 0000000000000..532ecc2909d91
--- /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 0000000000000..8cc71ac988e2f
--- /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 0000000000000..45ace3236c9f2
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeConfig.shared.ts
@@ -0,0 +1,31 @@
+// smithy-typescript generated code
+import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
+import { NoOpLogger } from "@smithy/smithy-client";
+import { parseUrl } from "@smithy/url-parser";
+import { fromBase64, toBase64 } from "@smithy/util-base64";
+import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
+
+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 ?? [],
+ 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 0000000000000..72509551094df
--- /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 0000000000000..454a50e807341
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/src/runtimeExtensions.ts
@@ -0,0 +1,45 @@
+// 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 { 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)),
+ };
+
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
+
+ return {
+ ...runtimeConfig,
+ ...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
+ ...resolveDefaultRuntimeConfig(extensionConfiguration),
+ ...resolveHttpHandlerRuntimeConfig(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 0000000000000..bb49d05617528
--- /dev/null
+++ b/private/aws-protocoltests-restxml-s3/test/functional/restxml.spec.ts
@@ -0,0 +1,642 @@
+// 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");
+
+ 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");
+
+ 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 0000000000000..3567d85ba8460
--- /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 0000000000000..809f57bde65e6
--- /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 0000000000000..e7f5ec56b742b
--- /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 0000000000000..4c3dfa7b3d25f
--- /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/**/*"]
+}