UNPKG

@serverless-stack/nextjs-lambda

Version:

Provides handlers that can be used in CloudFront Lambda@Edge to deploy next.js applications to the edge

1,345 lines (1,339 loc) 118 kB
'use strict'; var index = require('./index-2ba926b7.js'); require('./regeneration-handler-13d8a068.js'); require('stream'); require('zlib'); require('http'); require('./manifest.json'); // Build indexes outside so we allocate them once. var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; // These must be kept in order // prettier-ignore var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; /** * Builds a proper UTC HttpDate timestamp from a Date object * since not all environments will have this as the expected * format. * * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString * > Prior to ECMAScript 2018, the format of the return value * > varied according to the platform. The most common return * > value was an RFC-1123 formatted date stamp, which is a * > slightly updated version of RFC-822 date stamps. */ function dateToUtcString(date) { var year = date.getUTCFullYear(); var month = date.getUTCMonth(); var dayOfWeek = date.getUTCDay(); var dayOfMonthInt = date.getUTCDate(); var hoursInt = date.getUTCHours(); var minutesInt = date.getUTCMinutes(); var secondsInt = date.getUTCSeconds(); // Build 0 prefixed strings for contents that need to be // two digits and where we get an integer back. var dayOfMonthString = dayOfMonthInt < 10 ? "0" + dayOfMonthInt : "" + dayOfMonthInt; var hoursString = hoursInt < 10 ? "0" + hoursInt : "" + hoursInt; var minutesString = minutesInt < 10 ? "0" + minutesInt : "" + minutesInt; var secondsString = secondsInt < 10 ? "0" + secondsInt : "" + secondsInt; return DAYS[dayOfWeek] + ", " + dayOfMonthString + " " + MONTHS[month] + " " + year + " " + hoursString + ":" + minutesString + ":" + secondsString + " GMT"; } var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; var DOTS_PATTERN = /\.\./; var DOT_PATTERN = /\./; var S3_HOSTNAME_PATTERN = /^(.+\.)?s3[.-]([a-z0-9-]+)\./; var S3_US_EAST_1_ALTNAME_PATTERN = /^s3(-external-1)?\.amazonaws\.com$/; var AWS_PARTITION_SUFFIX = "amazonaws.com"; var isBucketNameOptions = function (options) { return typeof options.bucketName === "string"; }; /** * Get pseudo region from supplied region. For example, if supplied with `fips-us-west-2`, it returns `us-west-2`. * @internal */ var getPseudoRegion = function (region) { return (isFipsRegion(region) ? region.replace(/fips-|-fips/, "") : region); }; /** * Determines whether a given string is DNS compliant per the rules outlined by * S3. Length, capitaization, and leading dot restrictions are enforced by the * DOMAIN_PATTERN regular expression. * @internal * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html */ var isDnsCompatibleBucketName = function (bucketName) { return DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName); }; var getRegionalSuffix = function (hostname) { var parts = hostname.match(S3_HOSTNAME_PATTERN); return [parts[2], hostname.replace(new RegExp("^" + parts[0]), "")]; }; var getSuffix = function (hostname) { return S3_US_EAST_1_ALTNAME_PATTERN.test(hostname) ? ["us-east-1", AWS_PARTITION_SUFFIX] : getRegionalSuffix(hostname); }; /** * Infer region and hostname suffix from a complete hostname * @internal * @param hostname - Hostname * @returns [Region, Hostname suffix] */ var getSuffixForArnEndpoint = function (hostname) { return S3_US_EAST_1_ALTNAME_PATTERN.test(hostname) ? [hostname.replace("." + AWS_PARTITION_SUFFIX, ""), AWS_PARTITION_SUFFIX] : getRegionalSuffix(hostname); }; var validateArnEndpointOptions = function (options) { if (options.pathStyleEndpoint) { throw new Error("Path-style S3 endpoint is not supported when bucket is an ARN"); } if (options.accelerateEndpoint) { throw new Error("Accelerate endpoint is not supported when bucket is an ARN"); } if (!options.tlsCompatible) { throw new Error("HTTPS is required when bucket is an ARN"); } }; var validateService = function (service) { if (service !== "s3" && service !== "s3-outposts" && service !== "s3-object-lambda") { throw new Error("Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component"); } }; var validateS3Service = function (service) { if (service !== "s3") { throw new Error("Expect 's3' in Accesspoint ARN service component"); } }; var validateOutpostService = function (service) { if (service !== "s3-outposts") { throw new Error("Expect 's3-posts' in Outpost ARN service component"); } }; /** * Validate partition inferred from ARN is the same to `options.clientPartition`. * @internal */ var validatePartition = function (partition, options) { if (partition !== options.clientPartition) { throw new Error("Partition in ARN is incompatible, got \"" + partition + "\" but expected \"" + options.clientPartition + "\""); } }; /** * validate region value inferred from ARN. If `options.useArnRegion` is set, it validates the region is not a FIPS * region. If `options.useArnRegion` is unset, it validates the region is equal to `options.clientRegion` or * `options.clientSigningRegion`. * @internal */ var validateRegion = function (region, options) { if (region === "") { throw new Error("ARN region is empty"); } if (isFipsRegion(options.clientRegion)) { if (!options.allowFipsRegion) { throw new Error("FIPS region is not supported"); } else if (!isEqualRegions(region, options.clientRegion)) { throw new Error("Client FIPS region " + options.clientRegion + " doesn't match region " + region + " in ARN"); } } if (!options.useArnRegion && !isEqualRegions(region, options.clientRegion) && !isEqualRegions(region, options.clientSigningRegion)) { throw new Error("Region in ARN is incompatible, got " + region + " but expected " + options.clientRegion); } }; /** * * @param region */ var validateRegionalClient = function (region) { if (["s3-external-1", "aws-global"].includes(getPseudoRegion(region))) { throw new Error("Client region " + region + " is not regional"); } }; /** * @internal */ var isFipsRegion = function (region) { return region.startsWith("fips-") || region.endsWith("-fips"); }; var isEqualRegions = function (regionA, regionB) { return regionA === regionB || getPseudoRegion(regionA) === regionB || regionA === getPseudoRegion(regionB); }; /** * Validate an account ID * @internal */ var validateAccountId = function (accountId) { if (!/[0-9]{12}/.exec(accountId)) { throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'"); } }; /** * Validate a host label according to https://tools.ietf.org/html/rfc3986#section-3.2.2 * @internal */ var validateDNSHostLabel = function (label, options) { if (options === void 0) { options = { tlsCompatible: true }; } // reference: https://tools.ietf.org/html/rfc3986#section-3.2.2 if (label.length >= 64 || !/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/.test(label) || /(\d+\.){3}\d+/.test(label) || /[.-]{2}/.test(label) || ((options === null || options === void 0 ? void 0 : options.tlsCompatible) && DOT_PATTERN.test(label))) { throw new Error("Invalid DNS label " + label); } }; /** * Validate and parse an Access Point ARN or Outposts ARN * @internal * * @param resource - The resource section of an ARN * @returns Access Point Name and optional Outpost ID. */ var getArnResources = function (resource) { var delimiter = resource.includes(":") ? ":" : "/"; var _a = index.__read(resource.split(delimiter)), resourceType = _a[0], rest = _a.slice(1); if (resourceType === "accesspoint") { // Parse accesspoint ARN if (rest.length !== 1 || rest[0] === "") { throw new Error("Access Point ARN should have one resource accesspoint" + delimiter + "{accesspointname}"); } return { accesspointName: rest[0] }; } else if (resourceType === "outpost") { // Parse outpost ARN if (!rest[0] || rest[1] !== "accesspoint" || !rest[2] || rest.length !== 3) { throw new Error("Outpost ARN should have resource outpost" + delimiter + "{outpostId}" + delimiter + "accesspoint" + delimiter + "{accesspointName}"); } var _b = index.__read(rest, 3), outpostId = _b[0]; _b[1]; var accesspointName = _b[2]; return { outpostId: outpostId, accesspointName: accesspointName }; } else { throw new Error("ARN resource should begin with 'accesspoint" + delimiter + "' or 'outpost" + delimiter + "'"); } }; /** * Throw if dual stack configuration is set to true. * @internal */ var validateNoDualstack = function (dualstackEndpoint) { if (dualstackEndpoint) throw new Error("Dualstack endpoint is not supported with Outpost"); }; /** * Validate region is not appended or prepended with a `fips-` * @internal */ var validateNoFIPS = function (region) { if (isFipsRegion(region !== null && region !== void 0 ? region : "")) throw new Error("FIPS region is not supported with Outpost, got " + region); }; var bucketHostname = function (options) { var isCustomEndpoint = options.isCustomEndpoint; options.baseHostname; var dualstackEndpoint = options.dualstackEndpoint, accelerateEndpoint = options.accelerateEndpoint; if (isCustomEndpoint) { if (dualstackEndpoint) throw new Error("Dualstack endpoint is not supported with custom endpoint"); if (accelerateEndpoint) throw new Error("Accelerate endpoint is not supported with custom endpoint"); } return isBucketNameOptions(options) ? // Construct endpoint when bucketName is a string referring to a bucket name getEndpointFromBucketName(index.__assign(index.__assign({}, options), { isCustomEndpoint: isCustomEndpoint })) : // Construct endpoint when bucketName is an ARN referring to an S3 resource like Access Point getEndpointFromArn(index.__assign(index.__assign({}, options), { isCustomEndpoint: isCustomEndpoint })); }; var getEndpointFromArn = function (options) { var isCustomEndpoint = options.isCustomEndpoint, baseHostname = options.baseHostname, clientRegion = options.clientRegion; var hostnameSuffix = isCustomEndpoint ? baseHostname : getSuffixForArnEndpoint(baseHostname)[1]; var pathStyleEndpoint = options.pathStyleEndpoint, _a = options.dualstackEndpoint, dualstackEndpoint = _a === void 0 ? false : _a, _b = options.accelerateEndpoint, accelerateEndpoint = _b === void 0 ? false : _b, _c = options.tlsCompatible, tlsCompatible = _c === void 0 ? true : _c, useArnRegion = options.useArnRegion, bucketName = options.bucketName, _d = options.clientPartition, clientPartition = _d === void 0 ? "aws" : _d, _e = options.clientSigningRegion, clientSigningRegion = _e === void 0 ? clientRegion : _e; validateArnEndpointOptions({ pathStyleEndpoint: pathStyleEndpoint, accelerateEndpoint: accelerateEndpoint, tlsCompatible: tlsCompatible }); // Validate and parse the ARN supplied as a bucket name var service = bucketName.service, partition = bucketName.partition, accountId = bucketName.accountId, region = bucketName.region, resource = bucketName.resource; validateService(service); validatePartition(partition, { clientPartition: clientPartition }); validateAccountId(accountId); validateRegionalClient(clientRegion); var _f = getArnResources(resource), accesspointName = _f.accesspointName, outpostId = _f.outpostId; var DNSHostLabel = accesspointName + "-" + accountId; validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible }); var endpointRegion = useArnRegion ? region : clientRegion; var signingRegion = useArnRegion ? region : clientSigningRegion; if (service === "s3-object-lambda") { validateRegion(region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true }); validateNoDualstack(dualstackEndpoint); return { bucketEndpoint: true, hostname: DNSHostLabel + "." + service + (isFipsRegion(clientRegion) ? "-fips" : "") + "." + getPseudoRegion(endpointRegion) + "." + hostnameSuffix, signingRegion: signingRegion, signingService: service, }; } else if (outpostId) { // if this is an Outpost ARN validateRegion(region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion }); validateOutpostService(service); validateDNSHostLabel(outpostId, { tlsCompatible: tlsCompatible }); validateNoDualstack(dualstackEndpoint); validateNoFIPS(endpointRegion); var hostnamePrefix_1 = DNSHostLabel + "." + outpostId; return { bucketEndpoint: true, hostname: "" + hostnamePrefix_1 + (isCustomEndpoint ? "" : ".s3-outposts." + endpointRegion) + "." + hostnameSuffix, signingRegion: signingRegion, signingService: "s3-outposts", }; } // construct endpoint from Accesspoint ARN validateRegion(region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true }); validateS3Service(service); var hostnamePrefix = "" + DNSHostLabel; return { bucketEndpoint: true, hostname: "" + hostnamePrefix + (isCustomEndpoint ? "" : ".s3-accesspoint" + (isFipsRegion(clientRegion) ? "-fips" : "") + (dualstackEndpoint ? ".dualstack" : "") + "." + getPseudoRegion(endpointRegion)) + "." + hostnameSuffix, signingRegion: signingRegion, }; }; var getEndpointFromBucketName = function (_a) { var _b = _a.accelerateEndpoint, accelerateEndpoint = _b === void 0 ? false : _b, region = _a.clientRegion, baseHostname = _a.baseHostname, bucketName = _a.bucketName, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.pathStyleEndpoint, pathStyleEndpoint = _d === void 0 ? false : _d, _e = _a.tlsCompatible, tlsCompatible = _e === void 0 ? true : _e, _f = _a.isCustomEndpoint, isCustomEndpoint = _f === void 0 ? false : _f; var _g = index.__read(isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname), 2), clientRegion = _g[0], hostnameSuffix = _g[1]; if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) { return { bucketEndpoint: false, hostname: dualstackEndpoint ? "s3.dualstack." + clientRegion + "." + hostnameSuffix : baseHostname, }; } if (accelerateEndpoint) { baseHostname = "s3-accelerate" + (dualstackEndpoint ? ".dualstack" : "") + "." + hostnameSuffix; } else if (dualstackEndpoint) { baseHostname = "s3.dualstack." + clientRegion + "." + hostnameSuffix; } return { bucketEndpoint: true, hostname: bucketName + "." + baseHostname, }; }; var bucketEndpointMiddleware = function (options) { return function (next, context) { return function (args) { return index.__awaiter(void 0, void 0, void 0, function () { var bucketName, replaceBucketInPath, request, bucketArn, clientRegion, _a, _b, partition, _c, signingRegion, useArnRegion, _d, hostname, bucketEndpoint, modifiedSigningRegion, signingService, clientRegion, _e, _f, hostname, bucketEndpoint; return index.__generator(this, function (_g) { switch (_g.label) { case 0: bucketName = args.input.Bucket; replaceBucketInPath = options.bucketEndpoint; request = args.request; if (!index.HttpRequest.isInstance(request)) return [3 /*break*/, 8]; if (!options.bucketEndpoint) return [3 /*break*/, 1]; request.hostname = bucketName; return [3 /*break*/, 7]; case 1: if (!index.validate(bucketName)) return [3 /*break*/, 5]; bucketArn = index.parse(bucketName); _a = getPseudoRegion; return [4 /*yield*/, options.region()]; case 2: clientRegion = _a.apply(void 0, [_g.sent()]); return [4 /*yield*/, options.regionInfoProvider(clientRegion)]; case 3: _b = (_g.sent()) || {}, partition = _b.partition, _c = _b.signingRegion, signingRegion = _c === void 0 ? clientRegion : _c; return [4 /*yield*/, options.useArnRegion()]; case 4: useArnRegion = _g.sent(); _d = bucketHostname({ bucketName: bucketArn, baseHostname: request.hostname, accelerateEndpoint: options.useAccelerateEndpoint, dualstackEndpoint: options.useDualstackEndpoint, pathStyleEndpoint: options.forcePathStyle, tlsCompatible: request.protocol === "https:", useArnRegion: useArnRegion, clientPartition: partition, clientSigningRegion: signingRegion, clientRegion: clientRegion, isCustomEndpoint: options.isCustomEndpoint, }), hostname = _d.hostname, bucketEndpoint = _d.bucketEndpoint, modifiedSigningRegion = _d.signingRegion, signingService = _d.signingService; // If the request needs to use a region or service name inferred from ARN that different from client region, we // need to set them in the handler context so the signer will use them if (modifiedSigningRegion && modifiedSigningRegion !== signingRegion) { context["signing_region"] = modifiedSigningRegion; } if (signingService && signingService !== "s3") { context["signing_service"] = signingService; } request.hostname = hostname; replaceBucketInPath = bucketEndpoint; return [3 /*break*/, 7]; case 5: _e = getPseudoRegion; return [4 /*yield*/, options.region()]; case 6: clientRegion = _e.apply(void 0, [_g.sent()]); _f = bucketHostname({ bucketName: bucketName, clientRegion: clientRegion, baseHostname: request.hostname, accelerateEndpoint: options.useAccelerateEndpoint, dualstackEndpoint: options.useDualstackEndpoint, pathStyleEndpoint: options.forcePathStyle, tlsCompatible: request.protocol === "https:", isCustomEndpoint: options.isCustomEndpoint, }), hostname = _f.hostname, bucketEndpoint = _f.bucketEndpoint; request.hostname = hostname; replaceBucketInPath = bucketEndpoint; _g.label = 7; case 7: if (replaceBucketInPath) { request.path = request.path.replace(/^(\/)?[^\/]+/, ""); if (request.path === "") { request.path = "/"; } } _g.label = 8; case 8: return [2 /*return*/, next(index.__assign(index.__assign({}, args), { request: request }))]; } }); }); }; }; }; var bucketEndpointMiddlewareOptions = { tags: ["BUCKET_ENDPOINT"], name: "bucketEndpointMiddleware", relation: "before", toMiddleware: "hostHeaderMiddleware", override: true, }; var getBucketEndpointPlugin = function (options) { return ({ applyToStack: function (clientStack) { clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions); }, }); }; var AbortIncompleteMultipartUpload; (function (AbortIncompleteMultipartUpload) { /** * @internal */ AbortIncompleteMultipartUpload.filterSensitiveLog = (obj) => ({ ...obj, }); })(AbortIncompleteMultipartUpload || (AbortIncompleteMultipartUpload = {})); var AbortMultipartUploadOutput; (function (AbortMultipartUploadOutput) { /** * @internal */ AbortMultipartUploadOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(AbortMultipartUploadOutput || (AbortMultipartUploadOutput = {})); var AbortMultipartUploadRequest; (function (AbortMultipartUploadRequest) { /** * @internal */ AbortMultipartUploadRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(AbortMultipartUploadRequest || (AbortMultipartUploadRequest = {})); var NoSuchUpload; (function (NoSuchUpload) { /** * @internal */ NoSuchUpload.filterSensitiveLog = (obj) => ({ ...obj, }); })(NoSuchUpload || (NoSuchUpload = {})); var AccelerateConfiguration; (function (AccelerateConfiguration) { /** * @internal */ AccelerateConfiguration.filterSensitiveLog = (obj) => ({ ...obj, }); })(AccelerateConfiguration || (AccelerateConfiguration = {})); var Grantee; (function (Grantee) { /** * @internal */ Grantee.filterSensitiveLog = (obj) => ({ ...obj, }); })(Grantee || (Grantee = {})); var Grant; (function (Grant) { /** * @internal */ Grant.filterSensitiveLog = (obj) => ({ ...obj, }); })(Grant || (Grant = {})); var Owner; (function (Owner) { /** * @internal */ Owner.filterSensitiveLog = (obj) => ({ ...obj, }); })(Owner || (Owner = {})); var AccessControlPolicy; (function (AccessControlPolicy) { /** * @internal */ AccessControlPolicy.filterSensitiveLog = (obj) => ({ ...obj, }); })(AccessControlPolicy || (AccessControlPolicy = {})); var AccessControlTranslation; (function (AccessControlTranslation) { /** * @internal */ AccessControlTranslation.filterSensitiveLog = (obj) => ({ ...obj, }); })(AccessControlTranslation || (AccessControlTranslation = {})); var CompleteMultipartUploadOutput; (function (CompleteMultipartUploadOutput) { /** * @internal */ CompleteMultipartUploadOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSEKMSKeyId && { SSEKMSKeyId: index.SENSITIVE_STRING }), }); })(CompleteMultipartUploadOutput || (CompleteMultipartUploadOutput = {})); var CompletedPart; (function (CompletedPart) { /** * @internal */ CompletedPart.filterSensitiveLog = (obj) => ({ ...obj, }); })(CompletedPart || (CompletedPart = {})); var CompletedMultipartUpload; (function (CompletedMultipartUpload) { /** * @internal */ CompletedMultipartUpload.filterSensitiveLog = (obj) => ({ ...obj, }); })(CompletedMultipartUpload || (CompletedMultipartUpload = {})); var CompleteMultipartUploadRequest; (function (CompleteMultipartUploadRequest) { /** * @internal */ CompleteMultipartUploadRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(CompleteMultipartUploadRequest || (CompleteMultipartUploadRequest = {})); var CopyObjectResult; (function (CopyObjectResult) { /** * @internal */ CopyObjectResult.filterSensitiveLog = (obj) => ({ ...obj, }); })(CopyObjectResult || (CopyObjectResult = {})); var CopyObjectOutput; (function (CopyObjectOutput) { /** * @internal */ CopyObjectOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSEKMSKeyId && { SSEKMSKeyId: index.SENSITIVE_STRING }), ...(obj.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: index.SENSITIVE_STRING }), }); })(CopyObjectOutput || (CopyObjectOutput = {})); var CopyObjectRequest; (function (CopyObjectRequest) { /** * @internal */ CopyObjectRequest.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSECustomerKey && { SSECustomerKey: index.SENSITIVE_STRING }), ...(obj.SSEKMSKeyId && { SSEKMSKeyId: index.SENSITIVE_STRING }), ...(obj.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: index.SENSITIVE_STRING }), ...(obj.CopySourceSSECustomerKey && { CopySourceSSECustomerKey: index.SENSITIVE_STRING }), }); })(CopyObjectRequest || (CopyObjectRequest = {})); var ObjectNotInActiveTierError; (function (ObjectNotInActiveTierError) { /** * @internal */ ObjectNotInActiveTierError.filterSensitiveLog = (obj) => ({ ...obj, }); })(ObjectNotInActiveTierError || (ObjectNotInActiveTierError = {})); var BucketAlreadyExists; (function (BucketAlreadyExists) { /** * @internal */ BucketAlreadyExists.filterSensitiveLog = (obj) => ({ ...obj, }); })(BucketAlreadyExists || (BucketAlreadyExists = {})); var BucketAlreadyOwnedByYou; (function (BucketAlreadyOwnedByYou) { /** * @internal */ BucketAlreadyOwnedByYou.filterSensitiveLog = (obj) => ({ ...obj, }); })(BucketAlreadyOwnedByYou || (BucketAlreadyOwnedByYou = {})); var CreateBucketOutput; (function (CreateBucketOutput) { /** * @internal */ CreateBucketOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(CreateBucketOutput || (CreateBucketOutput = {})); var CreateBucketConfiguration; (function (CreateBucketConfiguration) { /** * @internal */ CreateBucketConfiguration.filterSensitiveLog = (obj) => ({ ...obj, }); })(CreateBucketConfiguration || (CreateBucketConfiguration = {})); var CreateBucketRequest; (function (CreateBucketRequest) { /** * @internal */ CreateBucketRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(CreateBucketRequest || (CreateBucketRequest = {})); var CreateMultipartUploadOutput; (function (CreateMultipartUploadOutput) { /** * @internal */ CreateMultipartUploadOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSEKMSKeyId && { SSEKMSKeyId: index.SENSITIVE_STRING }), ...(obj.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: index.SENSITIVE_STRING }), }); })(CreateMultipartUploadOutput || (CreateMultipartUploadOutput = {})); var CreateMultipartUploadRequest; (function (CreateMultipartUploadRequest) { /** * @internal */ CreateMultipartUploadRequest.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSECustomerKey && { SSECustomerKey: index.SENSITIVE_STRING }), ...(obj.SSEKMSKeyId && { SSEKMSKeyId: index.SENSITIVE_STRING }), ...(obj.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: index.SENSITIVE_STRING }), }); })(CreateMultipartUploadRequest || (CreateMultipartUploadRequest = {})); var DeleteBucketRequest; (function (DeleteBucketRequest) { /** * @internal */ DeleteBucketRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketRequest || (DeleteBucketRequest = {})); var DeleteBucketAnalyticsConfigurationRequest; (function (DeleteBucketAnalyticsConfigurationRequest) { /** * @internal */ DeleteBucketAnalyticsConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketAnalyticsConfigurationRequest || (DeleteBucketAnalyticsConfigurationRequest = {})); var DeleteBucketCorsRequest; (function (DeleteBucketCorsRequest) { /** * @internal */ DeleteBucketCorsRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketCorsRequest || (DeleteBucketCorsRequest = {})); var DeleteBucketEncryptionRequest; (function (DeleteBucketEncryptionRequest) { /** * @internal */ DeleteBucketEncryptionRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketEncryptionRequest || (DeleteBucketEncryptionRequest = {})); var DeleteBucketIntelligentTieringConfigurationRequest; (function (DeleteBucketIntelligentTieringConfigurationRequest) { /** * @internal */ DeleteBucketIntelligentTieringConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketIntelligentTieringConfigurationRequest || (DeleteBucketIntelligentTieringConfigurationRequest = {})); var DeleteBucketInventoryConfigurationRequest; (function (DeleteBucketInventoryConfigurationRequest) { /** * @internal */ DeleteBucketInventoryConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketInventoryConfigurationRequest || (DeleteBucketInventoryConfigurationRequest = {})); var DeleteBucketLifecycleRequest; (function (DeleteBucketLifecycleRequest) { /** * @internal */ DeleteBucketLifecycleRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketLifecycleRequest || (DeleteBucketLifecycleRequest = {})); var DeleteBucketMetricsConfigurationRequest; (function (DeleteBucketMetricsConfigurationRequest) { /** * @internal */ DeleteBucketMetricsConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketMetricsConfigurationRequest || (DeleteBucketMetricsConfigurationRequest = {})); var DeleteBucketOwnershipControlsRequest; (function (DeleteBucketOwnershipControlsRequest) { /** * @internal */ DeleteBucketOwnershipControlsRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketOwnershipControlsRequest || (DeleteBucketOwnershipControlsRequest = {})); var DeleteBucketPolicyRequest; (function (DeleteBucketPolicyRequest) { /** * @internal */ DeleteBucketPolicyRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketPolicyRequest || (DeleteBucketPolicyRequest = {})); var DeleteBucketReplicationRequest; (function (DeleteBucketReplicationRequest) { /** * @internal */ DeleteBucketReplicationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketReplicationRequest || (DeleteBucketReplicationRequest = {})); var DeleteBucketTaggingRequest; (function (DeleteBucketTaggingRequest) { /** * @internal */ DeleteBucketTaggingRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketTaggingRequest || (DeleteBucketTaggingRequest = {})); var DeleteBucketWebsiteRequest; (function (DeleteBucketWebsiteRequest) { /** * @internal */ DeleteBucketWebsiteRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteBucketWebsiteRequest || (DeleteBucketWebsiteRequest = {})); var DeleteObjectOutput; (function (DeleteObjectOutput) { /** * @internal */ DeleteObjectOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectOutput || (DeleteObjectOutput = {})); var DeleteObjectRequest; (function (DeleteObjectRequest) { /** * @internal */ DeleteObjectRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectRequest || (DeleteObjectRequest = {})); var DeletedObject; (function (DeletedObject) { /** * @internal */ DeletedObject.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeletedObject || (DeletedObject = {})); var _Error; (function (_Error) { /** * @internal */ _Error.filterSensitiveLog = (obj) => ({ ...obj, }); })(_Error || (_Error = {})); var DeleteObjectsOutput; (function (DeleteObjectsOutput) { /** * @internal */ DeleteObjectsOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectsOutput || (DeleteObjectsOutput = {})); var ObjectIdentifier; (function (ObjectIdentifier) { /** * @internal */ ObjectIdentifier.filterSensitiveLog = (obj) => ({ ...obj, }); })(ObjectIdentifier || (ObjectIdentifier = {})); var Delete; (function (Delete) { /** * @internal */ Delete.filterSensitiveLog = (obj) => ({ ...obj, }); })(Delete || (Delete = {})); var DeleteObjectsRequest; (function (DeleteObjectsRequest) { /** * @internal */ DeleteObjectsRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectsRequest || (DeleteObjectsRequest = {})); var DeleteObjectTaggingOutput; (function (DeleteObjectTaggingOutput) { /** * @internal */ DeleteObjectTaggingOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectTaggingOutput || (DeleteObjectTaggingOutput = {})); var DeleteObjectTaggingRequest; (function (DeleteObjectTaggingRequest) { /** * @internal */ DeleteObjectTaggingRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeleteObjectTaggingRequest || (DeleteObjectTaggingRequest = {})); var DeletePublicAccessBlockRequest; (function (DeletePublicAccessBlockRequest) { /** * @internal */ DeletePublicAccessBlockRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(DeletePublicAccessBlockRequest || (DeletePublicAccessBlockRequest = {})); var GetBucketAccelerateConfigurationOutput; (function (GetBucketAccelerateConfigurationOutput) { /** * @internal */ GetBucketAccelerateConfigurationOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketAccelerateConfigurationOutput || (GetBucketAccelerateConfigurationOutput = {})); var GetBucketAccelerateConfigurationRequest; (function (GetBucketAccelerateConfigurationRequest) { /** * @internal */ GetBucketAccelerateConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketAccelerateConfigurationRequest || (GetBucketAccelerateConfigurationRequest = {})); var GetBucketAclOutput; (function (GetBucketAclOutput) { /** * @internal */ GetBucketAclOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketAclOutput || (GetBucketAclOutput = {})); var GetBucketAclRequest; (function (GetBucketAclRequest) { /** * @internal */ GetBucketAclRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketAclRequest || (GetBucketAclRequest = {})); var Tag; (function (Tag) { /** * @internal */ Tag.filterSensitiveLog = (obj) => ({ ...obj, }); })(Tag || (Tag = {})); var AnalyticsAndOperator; (function (AnalyticsAndOperator) { /** * @internal */ AnalyticsAndOperator.filterSensitiveLog = (obj) => ({ ...obj, }); })(AnalyticsAndOperator || (AnalyticsAndOperator = {})); var AnalyticsFilter; (function (AnalyticsFilter) { AnalyticsFilter.visit = (value, visitor) => { if (value.Prefix !== undefined) return visitor.Prefix(value.Prefix); if (value.Tag !== undefined) return visitor.Tag(value.Tag); if (value.And !== undefined) return visitor.And(value.And); return visitor._(value.$unknown[0], value.$unknown[1]); }; /** * @internal */ AnalyticsFilter.filterSensitiveLog = (obj) => { if (obj.Prefix !== undefined) return { Prefix: obj.Prefix }; if (obj.Tag !== undefined) return { Tag: Tag.filterSensitiveLog(obj.Tag) }; if (obj.And !== undefined) return { And: AnalyticsAndOperator.filterSensitiveLog(obj.And) }; if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; }; })(AnalyticsFilter || (AnalyticsFilter = {})); var AnalyticsS3BucketDestination; (function (AnalyticsS3BucketDestination) { /** * @internal */ AnalyticsS3BucketDestination.filterSensitiveLog = (obj) => ({ ...obj, }); })(AnalyticsS3BucketDestination || (AnalyticsS3BucketDestination = {})); var AnalyticsExportDestination; (function (AnalyticsExportDestination) { /** * @internal */ AnalyticsExportDestination.filterSensitiveLog = (obj) => ({ ...obj, }); })(AnalyticsExportDestination || (AnalyticsExportDestination = {})); var StorageClassAnalysisDataExport; (function (StorageClassAnalysisDataExport) { /** * @internal */ StorageClassAnalysisDataExport.filterSensitiveLog = (obj) => ({ ...obj, }); })(StorageClassAnalysisDataExport || (StorageClassAnalysisDataExport = {})); var StorageClassAnalysis; (function (StorageClassAnalysis) { /** * @internal */ StorageClassAnalysis.filterSensitiveLog = (obj) => ({ ...obj, }); })(StorageClassAnalysis || (StorageClassAnalysis = {})); var AnalyticsConfiguration; (function (AnalyticsConfiguration) { /** * @internal */ AnalyticsConfiguration.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Filter && { Filter: AnalyticsFilter.filterSensitiveLog(obj.Filter) }), }); })(AnalyticsConfiguration || (AnalyticsConfiguration = {})); var GetBucketAnalyticsConfigurationOutput; (function (GetBucketAnalyticsConfigurationOutput) { /** * @internal */ GetBucketAnalyticsConfigurationOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.AnalyticsConfiguration && { AnalyticsConfiguration: AnalyticsConfiguration.filterSensitiveLog(obj.AnalyticsConfiguration), }), }); })(GetBucketAnalyticsConfigurationOutput || (GetBucketAnalyticsConfigurationOutput = {})); var GetBucketAnalyticsConfigurationRequest; (function (GetBucketAnalyticsConfigurationRequest) { /** * @internal */ GetBucketAnalyticsConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketAnalyticsConfigurationRequest || (GetBucketAnalyticsConfigurationRequest = {})); var CORSRule; (function (CORSRule) { /** * @internal */ CORSRule.filterSensitiveLog = (obj) => ({ ...obj, }); })(CORSRule || (CORSRule = {})); var GetBucketCorsOutput; (function (GetBucketCorsOutput) { /** * @internal */ GetBucketCorsOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketCorsOutput || (GetBucketCorsOutput = {})); var GetBucketCorsRequest; (function (GetBucketCorsRequest) { /** * @internal */ GetBucketCorsRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketCorsRequest || (GetBucketCorsRequest = {})); var ServerSideEncryptionByDefault; (function (ServerSideEncryptionByDefault) { /** * @internal */ ServerSideEncryptionByDefault.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.KMSMasterKeyID && { KMSMasterKeyID: index.SENSITIVE_STRING }), }); })(ServerSideEncryptionByDefault || (ServerSideEncryptionByDefault = {})); var ServerSideEncryptionRule; (function (ServerSideEncryptionRule) { /** * @internal */ ServerSideEncryptionRule.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.ApplyServerSideEncryptionByDefault && { ApplyServerSideEncryptionByDefault: ServerSideEncryptionByDefault.filterSensitiveLog(obj.ApplyServerSideEncryptionByDefault), }), }); })(ServerSideEncryptionRule || (ServerSideEncryptionRule = {})); var ServerSideEncryptionConfiguration; (function (ServerSideEncryptionConfiguration) { /** * @internal */ ServerSideEncryptionConfiguration.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Rules && { Rules: obj.Rules.map((item) => ServerSideEncryptionRule.filterSensitiveLog(item)) }), }); })(ServerSideEncryptionConfiguration || (ServerSideEncryptionConfiguration = {})); var GetBucketEncryptionOutput; (function (GetBucketEncryptionOutput) { /** * @internal */ GetBucketEncryptionOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.ServerSideEncryptionConfiguration && { ServerSideEncryptionConfiguration: ServerSideEncryptionConfiguration.filterSensitiveLog(obj.ServerSideEncryptionConfiguration), }), }); })(GetBucketEncryptionOutput || (GetBucketEncryptionOutput = {})); var GetBucketEncryptionRequest; (function (GetBucketEncryptionRequest) { /** * @internal */ GetBucketEncryptionRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketEncryptionRequest || (GetBucketEncryptionRequest = {})); var IntelligentTieringAndOperator; (function (IntelligentTieringAndOperator) { /** * @internal */ IntelligentTieringAndOperator.filterSensitiveLog = (obj) => ({ ...obj, }); })(IntelligentTieringAndOperator || (IntelligentTieringAndOperator = {})); var IntelligentTieringFilter; (function (IntelligentTieringFilter) { /** * @internal */ IntelligentTieringFilter.filterSensitiveLog = (obj) => ({ ...obj, }); })(IntelligentTieringFilter || (IntelligentTieringFilter = {})); var Tiering; (function (Tiering) { /** * @internal */ Tiering.filterSensitiveLog = (obj) => ({ ...obj, }); })(Tiering || (Tiering = {})); var IntelligentTieringConfiguration; (function (IntelligentTieringConfiguration) { /** * @internal */ IntelligentTieringConfiguration.filterSensitiveLog = (obj) => ({ ...obj, }); })(IntelligentTieringConfiguration || (IntelligentTieringConfiguration = {})); var GetBucketIntelligentTieringConfigurationOutput; (function (GetBucketIntelligentTieringConfigurationOutput) { /** * @internal */ GetBucketIntelligentTieringConfigurationOutput.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketIntelligentTieringConfigurationOutput || (GetBucketIntelligentTieringConfigurationOutput = {})); var GetBucketIntelligentTieringConfigurationRequest; (function (GetBucketIntelligentTieringConfigurationRequest) { /** * @internal */ GetBucketIntelligentTieringConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketIntelligentTieringConfigurationRequest || (GetBucketIntelligentTieringConfigurationRequest = {})); var SSEKMS; (function (SSEKMS) { /** * @internal */ SSEKMS.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.KeyId && { KeyId: index.SENSITIVE_STRING }), }); })(SSEKMS || (SSEKMS = {})); var SSES3; (function (SSES3) { /** * @internal */ SSES3.filterSensitiveLog = (obj) => ({ ...obj, }); })(SSES3 || (SSES3 = {})); var InventoryEncryption; (function (InventoryEncryption) { /** * @internal */ InventoryEncryption.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.SSEKMS && { SSEKMS: SSEKMS.filterSensitiveLog(obj.SSEKMS) }), }); })(InventoryEncryption || (InventoryEncryption = {})); var InventoryS3BucketDestination; (function (InventoryS3BucketDestination) { /** * @internal */ InventoryS3BucketDestination.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Encryption && { Encryption: InventoryEncryption.filterSensitiveLog(obj.Encryption) }), }); })(InventoryS3BucketDestination || (InventoryS3BucketDestination = {})); var InventoryDestination; (function (InventoryDestination) { /** * @internal */ InventoryDestination.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.S3BucketDestination && { S3BucketDestination: InventoryS3BucketDestination.filterSensitiveLog(obj.S3BucketDestination), }), }); })(InventoryDestination || (InventoryDestination = {})); var InventoryFilter; (function (InventoryFilter) { /** * @internal */ InventoryFilter.filterSensitiveLog = (obj) => ({ ...obj, }); })(InventoryFilter || (InventoryFilter = {})); var InventorySchedule; (function (InventorySchedule) { /** * @internal */ InventorySchedule.filterSensitiveLog = (obj) => ({ ...obj, }); })(InventorySchedule || (InventorySchedule = {})); var InventoryConfiguration; (function (InventoryConfiguration) { /** * @internal */ InventoryConfiguration.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Destination && { Destination: InventoryDestination.filterSensitiveLog(obj.Destination) }), }); })(InventoryConfiguration || (InventoryConfiguration = {})); var GetBucketInventoryConfigurationOutput; (function (GetBucketInventoryConfigurationOutput) { /** * @internal */ GetBucketInventoryConfigurationOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.InventoryConfiguration && { InventoryConfiguration: InventoryConfiguration.filterSensitiveLog(obj.InventoryConfiguration), }), }); })(GetBucketInventoryConfigurationOutput || (GetBucketInventoryConfigurationOutput = {})); var GetBucketInventoryConfigurationRequest; (function (GetBucketInventoryConfigurationRequest) { /** * @internal */ GetBucketInventoryConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketInventoryConfigurationRequest || (GetBucketInventoryConfigurationRequest = {})); var LifecycleExpiration; (function (LifecycleExpiration) { /** * @internal */ LifecycleExpiration.filterSensitiveLog = (obj) => ({ ...obj, }); })(LifecycleExpiration || (LifecycleExpiration = {})); var LifecycleRuleAndOperator; (function (LifecycleRuleAndOperator) { /** * @internal */ LifecycleRuleAndOperator.filterSensitiveLog = (obj) => ({ ...obj, }); })(LifecycleRuleAndOperator || (LifecycleRuleAndOperator = {})); var LifecycleRuleFilter; (function (LifecycleRuleFilter) { LifecycleRuleFilter.visit = (value, visitor) => { if (value.Prefix !== undefined) return visitor.Prefix(value.Prefix); if (value.Tag !== undefined) return visitor.Tag(value.Tag); if (value.And !== undefined) return visitor.And(value.And); return visitor._(value.$unknown[0], value.$unknown[1]); }; /** * @internal */ LifecycleRuleFilter.filterSensitiveLog = (obj) => { if (obj.Prefix !== undefined) return { Prefix: obj.Prefix }; if (obj.Tag !== undefined) return { Tag: Tag.filterSensitiveLog(obj.Tag) }; if (obj.And !== undefined) return { And: LifecycleRuleAndOperator.filterSensitiveLog(obj.And) }; if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; }; })(LifecycleRuleFilter || (LifecycleRuleFilter = {})); var NoncurrentVersionExpiration; (function (NoncurrentVersionExpiration) { /** * @internal */ NoncurrentVersionExpiration.filterSensitiveLog = (obj) => ({ ...obj, }); })(NoncurrentVersionExpiration || (NoncurrentVersionExpiration = {})); var NoncurrentVersionTransition; (function (NoncurrentVersionTransition) { /** * @internal */ NoncurrentVersionTransition.filterSensitiveLog = (obj) => ({ ...obj, }); })(NoncurrentVersionTransition || (NoncurrentVersionTransition = {})); var Transition; (function (Transition) { /** * @internal */ Transition.filterSensitiveLog = (obj) => ({ ...obj, }); })(Transition || (Transition = {})); var LifecycleRule; (function (LifecycleRule) { /** * @internal */ LifecycleRule.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Filter && { Filter: LifecycleRuleFilter.filterSensitiveLog(obj.Filter) }), }); })(LifecycleRule || (LifecycleRule = {})); var GetBucketLifecycleConfigurationOutput; (function (GetBucketLifecycleConfigurationOutput) { /** * @internal */ GetBucketLifecycleConfigurationOutput.filterSensitiveLog = (obj) => ({ ...obj, ...(obj.Rules && { Rules: obj.Rules.map((item) => LifecycleRule.filterSensitiveLog(item)) }), }); })(GetBucketLifecycleConfigurationOutput || (GetBucketLifecycleConfigurationOutput = {})); var GetBucketLifecycleConfigurationRequest; (function (GetBucketLifecycleConfigurationRequest) { /** * @internal */ GetBucketLifecycleConfigurationRequest.filterSensitiveLog = (obj) => ({ ...obj, }); })(GetBucketLifecycleConfig