open-next-cdk
Version:
Deploy a NextJS app using OpenNext packaging to serverless AWS using CDK
1,251 lines (1,250 loc) • 364 kB
JavaScript
import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder";
import { HttpRequest as __HttpRequest, isValidHostname as __isValidHostname, } from "@smithy/protocol-http";
import { collectBody, dateToUtcString as __dateToUtcString, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, getArrayIfSingleItem as __getArrayIfSingleItem, getValueFromTextNode as __getValueFromTextNode, map, parseBoolean as __parseBoolean, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, parseRfc7231DateTime as __parseRfc7231DateTime, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, withBaseException, } from "@smithy/smithy-client";
import { XMLParser } from "fast-xml-parser";
import { AnalyticsFilter, BucketAlreadyExists, BucketAlreadyOwnedByYou, InvalidObjectState, LifecycleRuleFilter, MetricsFilter, NoSuchBucket, NoSuchKey, NoSuchUpload, NotFound, ObjectNotInActiveTierError, ReplicationRuleFilter, } from "../models/models_0";
import { ObjectAlreadyInActiveTierError, } from "../models/models_1";
import { S3ServiceException as __BaseException } from "../models/S3ServiceException";
export const se_AbortMultipartUploadCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"x-id": [, "AbortMultipartUpload"],
uploadId: [, __expectNonNull(input.UploadId, `UploadId`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_CompleteMultipartUploadCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/xml",
"x-amz-checksum-crc32": input.ChecksumCRC32,
"x-amz-checksum-crc32c": input.ChecksumCRC32C,
"x-amz-checksum-sha1": input.ChecksumSHA1,
"x-amz-checksum-sha256": input.ChecksumSHA256,
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key": input.SSECustomerKey,
"x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"x-id": [, "CompleteMultipartUpload"],
uploadId: [, __expectNonNull(input.UploadId, `UploadId`)],
});
let body;
if (input.MultipartUpload !== undefined) {
body = se_CompletedMultipartUpload(input.MultipartUpload, context);
}
let contents;
if (input.MultipartUpload !== undefined) {
contents = se_CompletedMultipartUpload(input.MultipartUpload, context);
contents = contents.withName("CompleteMultipartUpload");
body = '<?xml version="1.0" encoding="UTF-8"?>';
contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/");
body += contents.toString();
}
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_CopyObjectCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-acl": input.ACL,
"cache-control": input.CacheControl,
"x-amz-checksum-algorithm": input.ChecksumAlgorithm,
"content-disposition": input.ContentDisposition,
"content-encoding": input.ContentEncoding,
"content-language": input.ContentLanguage,
"content-type": input.ContentType,
"x-amz-copy-source": input.CopySource,
"x-amz-copy-source-if-match": input.CopySourceIfMatch,
"x-amz-copy-source-if-modified-since": [
() => isSerializableHeaderValue(input.CopySourceIfModifiedSince),
() => __dateToUtcString(input.CopySourceIfModifiedSince).toString(),
],
"x-amz-copy-source-if-none-match": input.CopySourceIfNoneMatch,
"x-amz-copy-source-if-unmodified-since": [
() => isSerializableHeaderValue(input.CopySourceIfUnmodifiedSince),
() => __dateToUtcString(input.CopySourceIfUnmodifiedSince).toString(),
],
expires: [() => isSerializableHeaderValue(input.Expires), () => __dateToUtcString(input.Expires).toString()],
"x-amz-grant-full-control": input.GrantFullControl,
"x-amz-grant-read": input.GrantRead,
"x-amz-grant-read-acp": input.GrantReadACP,
"x-amz-grant-write-acp": input.GrantWriteACP,
"x-amz-metadata-directive": input.MetadataDirective,
"x-amz-tagging-directive": input.TaggingDirective,
"x-amz-server-side-encryption": input.ServerSideEncryption,
"x-amz-storage-class": input.StorageClass,
"x-amz-website-redirect-location": input.WebsiteRedirectLocation,
"x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key": input.SSECustomerKey,
"x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5,
"x-amz-server-side-encryption-aws-kms-key-id": input.SSEKMSKeyId,
"x-amz-server-side-encryption-context": input.SSEKMSEncryptionContext,
"x-amz-server-side-encryption-bucket-key-enabled": [
() => isSerializableHeaderValue(input.BucketKeyEnabled),
() => input.BucketKeyEnabled.toString(),
],
"x-amz-copy-source-server-side-encryption-customer-algorithm": input.CopySourceSSECustomerAlgorithm,
"x-amz-copy-source-server-side-encryption-customer-key": input.CopySourceSSECustomerKey,
"x-amz-copy-source-server-side-encryption-customer-key-md5": input.CopySourceSSECustomerKeyMD5,
"x-amz-request-payer": input.RequestPayer,
"x-amz-tagging": input.Tagging,
"x-amz-object-lock-mode": input.ObjectLockMode,
"x-amz-object-lock-retain-until-date": [
() => isSerializableHeaderValue(input.ObjectLockRetainUntilDate),
() => (input.ObjectLockRetainUntilDate.toISOString().split(".")[0] + "Z").toString(),
],
"x-amz-object-lock-legal-hold": input.ObjectLockLegalHoldStatus,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-source-expected-bucket-owner": input.ExpectedSourceBucketOwner,
...(input.Metadata !== undefined &&
Object.keys(input.Metadata).reduce((acc, suffix) => {
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata[suffix];
return acc;
}, {})),
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"x-id": [, "CopyObject"],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_CreateBucketCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/xml",
"x-amz-acl": input.ACL,
"x-amz-grant-full-control": input.GrantFullControl,
"x-amz-grant-read": input.GrantRead,
"x-amz-grant-read-acp": input.GrantReadACP,
"x-amz-grant-write": input.GrantWrite,
"x-amz-grant-write-acp": input.GrantWriteACP,
"x-amz-bucket-object-lock-enabled": [
() => isSerializableHeaderValue(input.ObjectLockEnabledForBucket),
() => input.ObjectLockEnabledForBucket.toString(),
],
"x-amz-object-ownership": input.ObjectOwnership,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
let body;
if (input.CreateBucketConfiguration !== undefined) {
body = se_CreateBucketConfiguration(input.CreateBucketConfiguration, context);
}
let contents;
if (input.CreateBucketConfiguration !== undefined) {
contents = se_CreateBucketConfiguration(input.CreateBucketConfiguration, context);
body = '<?xml version="1.0" encoding="UTF-8"?>';
contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/");
body += contents.toString();
}
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const se_CreateMultipartUploadCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-acl": input.ACL,
"cache-control": input.CacheControl,
"content-disposition": input.ContentDisposition,
"content-encoding": input.ContentEncoding,
"content-language": input.ContentLanguage,
"content-type": input.ContentType,
expires: [() => isSerializableHeaderValue(input.Expires), () => __dateToUtcString(input.Expires).toString()],
"x-amz-grant-full-control": input.GrantFullControl,
"x-amz-grant-read": input.GrantRead,
"x-amz-grant-read-acp": input.GrantReadACP,
"x-amz-grant-write-acp": input.GrantWriteACP,
"x-amz-server-side-encryption": input.ServerSideEncryption,
"x-amz-storage-class": input.StorageClass,
"x-amz-website-redirect-location": input.WebsiteRedirectLocation,
"x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key": input.SSECustomerKey,
"x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5,
"x-amz-server-side-encryption-aws-kms-key-id": input.SSEKMSKeyId,
"x-amz-server-side-encryption-context": input.SSEKMSEncryptionContext,
"x-amz-server-side-encryption-bucket-key-enabled": [
() => isSerializableHeaderValue(input.BucketKeyEnabled),
() => input.BucketKeyEnabled.toString(),
],
"x-amz-request-payer": input.RequestPayer,
"x-amz-tagging": input.Tagging,
"x-amz-object-lock-mode": input.ObjectLockMode,
"x-amz-object-lock-retain-until-date": [
() => isSerializableHeaderValue(input.ObjectLockRetainUntilDate),
() => (input.ObjectLockRetainUntilDate.toISOString().split(".")[0] + "Z").toString(),
],
"x-amz-object-lock-legal-hold": input.ObjectLockLegalHoldStatus,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-checksum-algorithm": input.ChecksumAlgorithm,
...(input.Metadata !== undefined &&
Object.keys(input.Metadata).reduce((acc, suffix) => {
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata[suffix];
return acc;
}, {})),
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
uploads: [, ""],
"x-id": [, "CreateMultipartUpload"],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const se_DeleteBucketAnalyticsConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
analytics: [, ""],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketCorsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
cors: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketEncryptionCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
encryption: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketIntelligentTieringConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
"intelligent-tiering": [, ""],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketInventoryConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
inventory: [, ""],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketLifecycleCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
lifecycle: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketMetricsConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
metrics: [, ""],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketOwnershipControlsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
ownershipControls: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketPolicyCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
policy: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketReplicationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
replication: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketTaggingCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
tagging: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteBucketWebsiteCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
website: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteObjectCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-mfa": input.MFA,
"x-amz-request-payer": input.RequestPayer,
"x-amz-bypass-governance-retention": [
() => isSerializableHeaderValue(input.BypassGovernanceRetention),
() => input.BypassGovernanceRetention.toString(),
],
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"x-id": [, "DeleteObject"],
versionId: [, input.VersionId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteObjectsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/xml",
"x-amz-mfa": input.MFA,
"x-amz-request-payer": input.RequestPayer,
"x-amz-bypass-governance-retention": [
() => isSerializableHeaderValue(input.BypassGovernanceRetention),
() => input.BypassGovernanceRetention.toString(),
],
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-sdk-checksum-algorithm": input.ChecksumAlgorithm,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
delete: [, ""],
"x-id": [, "DeleteObjects"],
});
let body;
if (input.Delete !== undefined) {
body = se_Delete(input.Delete, context);
}
let contents;
if (input.Delete !== undefined) {
contents = se_Delete(input.Delete, context);
body = '<?xml version="1.0" encoding="UTF-8"?>';
contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/");
body += contents.toString();
}
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeleteObjectTaggingCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
tagging: [, ""],
versionId: [, input.VersionId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_DeletePublicAccessBlockCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
publicAccessBlock: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketAccelerateConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-request-payer": input.RequestPayer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
accelerate: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketAclCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
acl: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketAnalyticsConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
analytics: [, ""],
"x-id": [, "GetBucketAnalyticsConfiguration"],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketCorsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
cors: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketEncryptionCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
encryption: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketIntelligentTieringConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
"intelligent-tiering": [, ""],
"x-id": [, "GetBucketIntelligentTieringConfiguration"],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketInventoryConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
inventory: [, ""],
"x-id": [, "GetBucketInventoryConfiguration"],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketLifecycleConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
lifecycle: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketLocationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
location: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketLoggingCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
logging: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketMetricsConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
metrics: [, ""],
"x-id": [, "GetBucketMetricsConfiguration"],
id: [, __expectNonNull(input.Id, `Id`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketNotificationConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
notification: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketOwnershipControlsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
ownershipControls: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketPolicyCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
policy: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketPolicyStatusCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
policyStatus: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketReplicationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
replication: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketRequestPaymentCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
requestPayment: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketTaggingCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
tagging: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketVersioningCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
versioning: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetBucketWebsiteCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
website: [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetObjectCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"if-match": input.IfMatch,
"if-modified-since": [
() => isSerializableHeaderValue(input.IfModifiedSince),
() => __dateToUtcString(input.IfModifiedSince).toString(),
],
"if-none-match": input.IfNoneMatch,
"if-unmodified-since": [
() => isSerializableHeaderValue(input.IfUnmodifiedSince),
() => __dateToUtcString(input.IfUnmodifiedSince).toString(),
],
range: input.Range,
"x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key": input.SSECustomerKey,
"x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5,
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-checksum-mode": input.ChecksumMode,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"x-id": [, "GetObject"],
"response-cache-control": [, input.ResponseCacheControl],
"response-content-disposition": [, input.ResponseContentDisposition],
"response-content-encoding": [, input.ResponseContentEncoding],
"response-content-language": [, input.ResponseContentLanguage],
"response-content-type": [, input.ResponseContentType],
"response-expires": [
() => input.ResponseExpires !== void 0,
() => __dateToUtcString(input.ResponseExpires).toString(),
],
versionId: [, input.VersionId],
partNumber: [() => input.PartNumber !== void 0, () => input.PartNumber.toString()],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetObjectAclCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
acl: [, ""],
versionId: [, input.VersionId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetObjectAttributesCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-max-parts": [() => isSerializableHeaderValue(input.MaxParts), () => input.MaxParts.toString()],
"x-amz-part-number-marker": input.PartNumberMarker,
"x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key": input.SSECustomerKey,
"x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5,
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
"x-amz-object-attributes": [
() => isSerializableHeaderValue(input.ObjectAttributes),
() => (input.ObjectAttributes || []).map((_entry) => _entry).join(", "),
],
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
attributes: [, ""],
versionId: [, input.VersionId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetObjectLegalHoldCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-request-payer": input.RequestPayer,
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Key+}";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "Key", () => input.Key, "{Key+}", true);
const query = map({
"legal-hold": [, ""],
versionId: [, input.VersionId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const se_GetObjectLockConfigurationCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
resolvedPath = __resolvedPath(resolvedPath, input, "Bucket", () => input.Bucket, "{Bucket}", false);
const query = map({
"object-lock": [, ""],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,