UNPKG

@softchef/cdk-iot-device-management

Version:

IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.

854 lines 566 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeAws_restXmlGetPublicAccessBlockCommand = exports.serializeAws_restXmlGetObjectTorrentCommand = exports.serializeAws_restXmlGetObjectTaggingCommand = exports.serializeAws_restXmlGetObjectRetentionCommand = exports.serializeAws_restXmlGetObjectLockConfigurationCommand = exports.serializeAws_restXmlGetObjectLegalHoldCommand = exports.serializeAws_restXmlGetObjectAclCommand = exports.serializeAws_restXmlGetObjectCommand = exports.serializeAws_restXmlGetBucketWebsiteCommand = exports.serializeAws_restXmlGetBucketVersioningCommand = exports.serializeAws_restXmlGetBucketTaggingCommand = exports.serializeAws_restXmlGetBucketRequestPaymentCommand = exports.serializeAws_restXmlGetBucketReplicationCommand = exports.serializeAws_restXmlGetBucketPolicyStatusCommand = exports.serializeAws_restXmlGetBucketPolicyCommand = exports.serializeAws_restXmlGetBucketOwnershipControlsCommand = exports.serializeAws_restXmlGetBucketNotificationConfigurationCommand = exports.serializeAws_restXmlGetBucketMetricsConfigurationCommand = exports.serializeAws_restXmlGetBucketLoggingCommand = exports.serializeAws_restXmlGetBucketLocationCommand = exports.serializeAws_restXmlGetBucketLifecycleConfigurationCommand = exports.serializeAws_restXmlGetBucketInventoryConfigurationCommand = exports.serializeAws_restXmlGetBucketIntelligentTieringConfigurationCommand = exports.serializeAws_restXmlGetBucketEncryptionCommand = exports.serializeAws_restXmlGetBucketCorsCommand = exports.serializeAws_restXmlGetBucketAnalyticsConfigurationCommand = exports.serializeAws_restXmlGetBucketAclCommand = exports.serializeAws_restXmlGetBucketAccelerateConfigurationCommand = exports.serializeAws_restXmlDeletePublicAccessBlockCommand = exports.serializeAws_restXmlDeleteObjectTaggingCommand = exports.serializeAws_restXmlDeleteObjectsCommand = exports.serializeAws_restXmlDeleteObjectCommand = exports.serializeAws_restXmlDeleteBucketWebsiteCommand = exports.serializeAws_restXmlDeleteBucketTaggingCommand = exports.serializeAws_restXmlDeleteBucketReplicationCommand = exports.serializeAws_restXmlDeleteBucketPolicyCommand = exports.serializeAws_restXmlDeleteBucketOwnershipControlsCommand = exports.serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = exports.serializeAws_restXmlDeleteBucketLifecycleCommand = exports.serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = exports.serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand = exports.serializeAws_restXmlDeleteBucketEncryptionCommand = exports.serializeAws_restXmlDeleteBucketCorsCommand = exports.serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = exports.serializeAws_restXmlDeleteBucketCommand = exports.serializeAws_restXmlCreateMultipartUploadCommand = exports.serializeAws_restXmlCreateBucketCommand = exports.serializeAws_restXmlCopyObjectCommand = exports.serializeAws_restXmlCompleteMultipartUploadCommand = exports.serializeAws_restXmlAbortMultipartUploadCommand = void 0; exports.deserializeAws_restXmlDeleteBucketCorsCommand = exports.deserializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = exports.deserializeAws_restXmlDeleteBucketCommand = exports.deserializeAws_restXmlCreateMultipartUploadCommand = exports.deserializeAws_restXmlCreateBucketCommand = exports.deserializeAws_restXmlCopyObjectCommand = exports.deserializeAws_restXmlCompleteMultipartUploadCommand = exports.deserializeAws_restXmlAbortMultipartUploadCommand = exports.serializeAws_restXmlWriteGetObjectResponseCommand = exports.serializeAws_restXmlUploadPartCopyCommand = exports.serializeAws_restXmlUploadPartCommand = exports.serializeAws_restXmlSelectObjectContentCommand = exports.serializeAws_restXmlRestoreObjectCommand = exports.serializeAws_restXmlPutPublicAccessBlockCommand = exports.serializeAws_restXmlPutObjectTaggingCommand = exports.serializeAws_restXmlPutObjectRetentionCommand = exports.serializeAws_restXmlPutObjectLockConfigurationCommand = exports.serializeAws_restXmlPutObjectLegalHoldCommand = exports.serializeAws_restXmlPutObjectAclCommand = exports.serializeAws_restXmlPutObjectCommand = exports.serializeAws_restXmlPutBucketWebsiteCommand = exports.serializeAws_restXmlPutBucketVersioningCommand = exports.serializeAws_restXmlPutBucketTaggingCommand = exports.serializeAws_restXmlPutBucketRequestPaymentCommand = exports.serializeAws_restXmlPutBucketReplicationCommand = exports.serializeAws_restXmlPutBucketPolicyCommand = exports.serializeAws_restXmlPutBucketOwnershipControlsCommand = exports.serializeAws_restXmlPutBucketNotificationConfigurationCommand = exports.serializeAws_restXmlPutBucketMetricsConfigurationCommand = exports.serializeAws_restXmlPutBucketLoggingCommand = exports.serializeAws_restXmlPutBucketLifecycleConfigurationCommand = exports.serializeAws_restXmlPutBucketInventoryConfigurationCommand = exports.serializeAws_restXmlPutBucketIntelligentTieringConfigurationCommand = exports.serializeAws_restXmlPutBucketEncryptionCommand = exports.serializeAws_restXmlPutBucketCorsCommand = exports.serializeAws_restXmlPutBucketAnalyticsConfigurationCommand = exports.serializeAws_restXmlPutBucketAclCommand = exports.serializeAws_restXmlPutBucketAccelerateConfigurationCommand = exports.serializeAws_restXmlListPartsCommand = exports.serializeAws_restXmlListObjectVersionsCommand = exports.serializeAws_restXmlListObjectsV2Command = exports.serializeAws_restXmlListObjectsCommand = exports.serializeAws_restXmlListMultipartUploadsCommand = exports.serializeAws_restXmlListBucketsCommand = exports.serializeAws_restXmlListBucketMetricsConfigurationsCommand = exports.serializeAws_restXmlListBucketInventoryConfigurationsCommand = exports.serializeAws_restXmlListBucketIntelligentTieringConfigurationsCommand = exports.serializeAws_restXmlListBucketAnalyticsConfigurationsCommand = exports.serializeAws_restXmlHeadObjectCommand = exports.serializeAws_restXmlHeadBucketCommand = void 0; exports.deserializeAws_restXmlListMultipartUploadsCommand = exports.deserializeAws_restXmlListBucketsCommand = exports.deserializeAws_restXmlListBucketMetricsConfigurationsCommand = exports.deserializeAws_restXmlListBucketInventoryConfigurationsCommand = exports.deserializeAws_restXmlListBucketIntelligentTieringConfigurationsCommand = exports.deserializeAws_restXmlListBucketAnalyticsConfigurationsCommand = exports.deserializeAws_restXmlHeadObjectCommand = exports.deserializeAws_restXmlHeadBucketCommand = exports.deserializeAws_restXmlGetPublicAccessBlockCommand = exports.deserializeAws_restXmlGetObjectTorrentCommand = exports.deserializeAws_restXmlGetObjectTaggingCommand = exports.deserializeAws_restXmlGetObjectRetentionCommand = exports.deserializeAws_restXmlGetObjectLockConfigurationCommand = exports.deserializeAws_restXmlGetObjectLegalHoldCommand = exports.deserializeAws_restXmlGetObjectAclCommand = exports.deserializeAws_restXmlGetObjectCommand = exports.deserializeAws_restXmlGetBucketWebsiteCommand = exports.deserializeAws_restXmlGetBucketVersioningCommand = exports.deserializeAws_restXmlGetBucketTaggingCommand = exports.deserializeAws_restXmlGetBucketRequestPaymentCommand = exports.deserializeAws_restXmlGetBucketReplicationCommand = exports.deserializeAws_restXmlGetBucketPolicyStatusCommand = exports.deserializeAws_restXmlGetBucketPolicyCommand = exports.deserializeAws_restXmlGetBucketOwnershipControlsCommand = exports.deserializeAws_restXmlGetBucketNotificationConfigurationCommand = exports.deserializeAws_restXmlGetBucketMetricsConfigurationCommand = exports.deserializeAws_restXmlGetBucketLoggingCommand = exports.deserializeAws_restXmlGetBucketLocationCommand = exports.deserializeAws_restXmlGetBucketLifecycleConfigurationCommand = exports.deserializeAws_restXmlGetBucketInventoryConfigurationCommand = exports.deserializeAws_restXmlGetBucketIntelligentTieringConfigurationCommand = exports.deserializeAws_restXmlGetBucketEncryptionCommand = exports.deserializeAws_restXmlGetBucketCorsCommand = exports.deserializeAws_restXmlGetBucketAnalyticsConfigurationCommand = exports.deserializeAws_restXmlGetBucketAclCommand = exports.deserializeAws_restXmlGetBucketAccelerateConfigurationCommand = exports.deserializeAws_restXmlDeletePublicAccessBlockCommand = exports.deserializeAws_restXmlDeleteObjectTaggingCommand = exports.deserializeAws_restXmlDeleteObjectsCommand = exports.deserializeAws_restXmlDeleteObjectCommand = exports.deserializeAws_restXmlDeleteBucketWebsiteCommand = exports.deserializeAws_restXmlDeleteBucketTaggingCommand = exports.deserializeAws_restXmlDeleteBucketReplicationCommand = exports.deserializeAws_restXmlDeleteBucketPolicyCommand = exports.deserializeAws_restXmlDeleteBucketOwnershipControlsCommand = exports.deserializeAws_restXmlDeleteBucketMetricsConfigurationCommand = exports.deserializeAws_restXmlDeleteBucketLifecycleCommand = exports.deserializeAws_restXmlDeleteBucketInventoryConfigurationCommand = exports.deserializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand = exports.deserializeAws_restXmlDeleteBucketEncryptionCommand = void 0; exports.deserializeAws_restXmlWriteGetObjectResponseCommand = exports.deserializeAws_restXmlUploadPartCopyCommand = exports.deserializeAws_restXmlUploadPartCommand = exports.deserializeAws_restXmlSelectObjectContentCommand = exports.deserializeAws_restXmlRestoreObjectCommand = exports.deserializeAws_restXmlPutPublicAccessBlockCommand = exports.deserializeAws_restXmlPutObjectTaggingCommand = exports.deserializeAws_restXmlPutObjectRetentionCommand = exports.deserializeAws_restXmlPutObjectLockConfigurationCommand = exports.deserializeAws_restXmlPutObjectLegalHoldCommand = exports.deserializeAws_restXmlPutObjectAclCommand = exports.deserializeAws_restXmlPutObjectCommand = exports.deserializeAws_restXmlPutBucketWebsiteCommand = exports.deserializeAws_restXmlPutBucketVersioningCommand = exports.deserializeAws_restXmlPutBucketTaggingCommand = exports.deserializeAws_restXmlPutBucketRequestPaymentCommand = exports.deserializeAws_restXmlPutBucketReplicationCommand = exports.deserializeAws_restXmlPutBucketPolicyCommand = exports.deserializeAws_restXmlPutBucketOwnershipControlsCommand = exports.deserializeAws_restXmlPutBucketNotificationConfigurationCommand = exports.deserializeAws_restXmlPutBucketMetricsConfigurationCommand = exports.deserializeAws_restXmlPutBucketLoggingCommand = exports.deserializeAws_restXmlPutBucketLifecycleConfigurationCommand = exports.deserializeAws_restXmlPutBucketInventoryConfigurationCommand = exports.deserializeAws_restXmlPutBucketIntelligentTieringConfigurationCommand = exports.deserializeAws_restXmlPutBucketEncryptionCommand = exports.deserializeAws_restXmlPutBucketCorsCommand = exports.deserializeAws_restXmlPutBucketAnalyticsConfigurationCommand = exports.deserializeAws_restXmlPutBucketAclCommand = exports.deserializeAws_restXmlPutBucketAccelerateConfigurationCommand = exports.deserializeAws_restXmlListPartsCommand = exports.deserializeAws_restXmlListObjectVersionsCommand = exports.deserializeAws_restXmlListObjectsV2Command = exports.deserializeAws_restXmlListObjectsCommand = void 0; const protocol_http_1 = require("@aws-sdk/protocol-http"); const smithy_client_1 = require("@aws-sdk/smithy-client"); const xml_builder_1 = require("@aws-sdk/xml-builder"); const entities_1 = require("entities"); const fast_xml_parser_1 = require("fast-xml-parser"); const models_0_1 = require("../models/models_0"); const serializeAws_restXmlAbortMultipartUploadCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } if (input.Key !== undefined) { const labelValue = input.Key; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Key."); } resolvedPath = resolvedPath.replace("{Key+}", labelValue .split("/") .map((segment) => smithy_client_1.extendedEncodeURIComponent(segment)) .join("/")); } else { throw new Error("No value provided for input HTTP label: Key."); } const query = { "x-id": "AbortMultipartUpload", ...(input.UploadId !== undefined && { uploadId: input.UploadId }), }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlAbortMultipartUploadCommand = serializeAws_restXmlAbortMultipartUploadCommand; const serializeAws_restXmlCompleteMultipartUploadCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } if (input.Key !== undefined) { const labelValue = input.Key; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Key."); } resolvedPath = resolvedPath.replace("{Key+}", labelValue .split("/") .map((segment) => smithy_client_1.extendedEncodeURIComponent(segment)) .join("/")); } else { throw new Error("No value provided for input HTTP label: Key."); } const query = { "x-id": "CompleteMultipartUpload", ...(input.UploadId !== undefined && { uploadId: input.UploadId }), }; let body; if (input.MultipartUpload !== undefined) { body = serializeAws_restXmlCompletedMultipartUpload(input.MultipartUpload, context); } let contents; if (input.MultipartUpload !== undefined) { contents = serializeAws_restXmlCompletedMultipartUpload(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 protocol_http_1.HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlCompleteMultipartUploadCommand = serializeAws_restXmlCompleteMultipartUploadCommand; const serializeAws_restXmlCopyObjectCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL }), ...(isSerializableHeaderValue(input.CacheControl) && { "cache-control": input.CacheControl }), ...(isSerializableHeaderValue(input.ContentDisposition) && { "content-disposition": input.ContentDisposition }), ...(isSerializableHeaderValue(input.ContentEncoding) && { "content-encoding": input.ContentEncoding }), ...(isSerializableHeaderValue(input.ContentLanguage) && { "content-language": input.ContentLanguage }), ...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType }), ...(isSerializableHeaderValue(input.CopySource) && { "x-amz-copy-source": input.CopySource }), ...(isSerializableHeaderValue(input.CopySourceIfMatch) && { "x-amz-copy-source-if-match": input.CopySourceIfMatch, }), ...(isSerializableHeaderValue(input.CopySourceIfModifiedSince) && { "x-amz-copy-source-if-modified-since": smithy_client_1.dateToUtcString(input.CopySourceIfModifiedSince).toString(), }), ...(isSerializableHeaderValue(input.CopySourceIfNoneMatch) && { "x-amz-copy-source-if-none-match": input.CopySourceIfNoneMatch, }), ...(isSerializableHeaderValue(input.CopySourceIfUnmodifiedSince) && { "x-amz-copy-source-if-unmodified-since": smithy_client_1.dateToUtcString(input.CopySourceIfUnmodifiedSince).toString(), }), ...(isSerializableHeaderValue(input.Expires) && { expires: smithy_client_1.dateToUtcString(input.Expires).toString() }), ...(isSerializableHeaderValue(input.GrantFullControl) && { "x-amz-grant-full-control": input.GrantFullControl }), ...(isSerializableHeaderValue(input.GrantRead) && { "x-amz-grant-read": input.GrantRead }), ...(isSerializableHeaderValue(input.GrantReadACP) && { "x-amz-grant-read-acp": input.GrantReadACP }), ...(isSerializableHeaderValue(input.GrantWriteACP) && { "x-amz-grant-write-acp": input.GrantWriteACP }), ...(isSerializableHeaderValue(input.MetadataDirective) && { "x-amz-metadata-directive": input.MetadataDirective }), ...(isSerializableHeaderValue(input.TaggingDirective) && { "x-amz-tagging-directive": input.TaggingDirective }), ...(isSerializableHeaderValue(input.ServerSideEncryption) && { "x-amz-server-side-encryption": input.ServerSideEncryption, }), ...(isSerializableHeaderValue(input.StorageClass) && { "x-amz-storage-class": input.StorageClass }), ...(isSerializableHeaderValue(input.WebsiteRedirectLocation) && { "x-amz-website-redirect-location": input.WebsiteRedirectLocation, }), ...(isSerializableHeaderValue(input.SSECustomerAlgorithm) && { "x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm, }), ...(isSerializableHeaderValue(input.SSECustomerKey) && { "x-amz-server-side-encryption-customer-key": input.SSECustomerKey, }), ...(isSerializableHeaderValue(input.SSECustomerKeyMD5) && { "x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5, }), ...(isSerializableHeaderValue(input.SSEKMSKeyId) && { "x-amz-server-side-encryption-aws-kms-key-id": input.SSEKMSKeyId, }), ...(isSerializableHeaderValue(input.SSEKMSEncryptionContext) && { "x-amz-server-side-encryption-context": input.SSEKMSEncryptionContext, }), ...(isSerializableHeaderValue(input.BucketKeyEnabled) && { "x-amz-server-side-encryption-bucket-key-enabled": input.BucketKeyEnabled.toString(), }), ...(isSerializableHeaderValue(input.CopySourceSSECustomerAlgorithm) && { "x-amz-copy-source-server-side-encryption-customer-algorithm": input.CopySourceSSECustomerAlgorithm, }), ...(isSerializableHeaderValue(input.CopySourceSSECustomerKey) && { "x-amz-copy-source-server-side-encryption-customer-key": input.CopySourceSSECustomerKey, }), ...(isSerializableHeaderValue(input.CopySourceSSECustomerKeyMD5) && { "x-amz-copy-source-server-side-encryption-customer-key-md5": input.CopySourceSSECustomerKeyMD5, }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer }), ...(isSerializableHeaderValue(input.Tagging) && { "x-amz-tagging": input.Tagging }), ...(isSerializableHeaderValue(input.ObjectLockMode) && { "x-amz-object-lock-mode": input.ObjectLockMode }), ...(isSerializableHeaderValue(input.ObjectLockRetainUntilDate) && { "x-amz-object-lock-retain-until-date": (input.ObjectLockRetainUntilDate.toISOString().split(".")[0] + "Z").toString(), }), ...(isSerializableHeaderValue(input.ObjectLockLegalHoldStatus) && { "x-amz-object-lock-legal-hold": input.ObjectLockLegalHoldStatus, }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), ...(isSerializableHeaderValue(input.ExpectedSourceBucketOwner) && { "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], }), {})), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } if (input.Key !== undefined) { const labelValue = input.Key; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Key."); } resolvedPath = resolvedPath.replace("{Key+}", labelValue .split("/") .map((segment) => smithy_client_1.extendedEncodeURIComponent(segment)) .join("/")); } else { throw new Error("No value provided for input HTTP label: Key."); } const query = { "x-id": "CopyObject", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "PUT", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlCopyObjectCommand = serializeAws_restXmlCopyObjectCommand; const serializeAws_restXmlCreateBucketCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL }), ...(isSerializableHeaderValue(input.GrantFullControl) && { "x-amz-grant-full-control": input.GrantFullControl }), ...(isSerializableHeaderValue(input.GrantRead) && { "x-amz-grant-read": input.GrantRead }), ...(isSerializableHeaderValue(input.GrantReadACP) && { "x-amz-grant-read-acp": input.GrantReadACP }), ...(isSerializableHeaderValue(input.GrantWrite) && { "x-amz-grant-write": input.GrantWrite }), ...(isSerializableHeaderValue(input.GrantWriteACP) && { "x-amz-grant-write-acp": input.GrantWriteACP }), ...(isSerializableHeaderValue(input.ObjectLockEnabledForBucket) && { "x-amz-bucket-object-lock-enabled": input.ObjectLockEnabledForBucket.toString(), }), ...(isSerializableHeaderValue(input.ObjectOwnership) && { "x-amz-object-ownership": input.ObjectOwnership }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } let body; if (input.CreateBucketConfiguration !== undefined) { body = serializeAws_restXmlCreateBucketConfiguration(input.CreateBucketConfiguration, context); } let contents; if (input.CreateBucketConfiguration !== undefined) { contents = serializeAws_restXmlCreateBucketConfiguration(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 protocol_http_1.HttpRequest({ protocol, hostname, port, method: "PUT", headers, path: resolvedPath, body, }); }; exports.serializeAws_restXmlCreateBucketCommand = serializeAws_restXmlCreateBucketCommand; const serializeAws_restXmlCreateMultipartUploadCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL }), ...(isSerializableHeaderValue(input.CacheControl) && { "cache-control": input.CacheControl }), ...(isSerializableHeaderValue(input.ContentDisposition) && { "content-disposition": input.ContentDisposition }), ...(isSerializableHeaderValue(input.ContentEncoding) && { "content-encoding": input.ContentEncoding }), ...(isSerializableHeaderValue(input.ContentLanguage) && { "content-language": input.ContentLanguage }), ...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType }), ...(isSerializableHeaderValue(input.Expires) && { expires: smithy_client_1.dateToUtcString(input.Expires).toString() }), ...(isSerializableHeaderValue(input.GrantFullControl) && { "x-amz-grant-full-control": input.GrantFullControl }), ...(isSerializableHeaderValue(input.GrantRead) && { "x-amz-grant-read": input.GrantRead }), ...(isSerializableHeaderValue(input.GrantReadACP) && { "x-amz-grant-read-acp": input.GrantReadACP }), ...(isSerializableHeaderValue(input.GrantWriteACP) && { "x-amz-grant-write-acp": input.GrantWriteACP }), ...(isSerializableHeaderValue(input.ServerSideEncryption) && { "x-amz-server-side-encryption": input.ServerSideEncryption, }), ...(isSerializableHeaderValue(input.StorageClass) && { "x-amz-storage-class": input.StorageClass }), ...(isSerializableHeaderValue(input.WebsiteRedirectLocation) && { "x-amz-website-redirect-location": input.WebsiteRedirectLocation, }), ...(isSerializableHeaderValue(input.SSECustomerAlgorithm) && { "x-amz-server-side-encryption-customer-algorithm": input.SSECustomerAlgorithm, }), ...(isSerializableHeaderValue(input.SSECustomerKey) && { "x-amz-server-side-encryption-customer-key": input.SSECustomerKey, }), ...(isSerializableHeaderValue(input.SSECustomerKeyMD5) && { "x-amz-server-side-encryption-customer-key-md5": input.SSECustomerKeyMD5, }), ...(isSerializableHeaderValue(input.SSEKMSKeyId) && { "x-amz-server-side-encryption-aws-kms-key-id": input.SSEKMSKeyId, }), ...(isSerializableHeaderValue(input.SSEKMSEncryptionContext) && { "x-amz-server-side-encryption-context": input.SSEKMSEncryptionContext, }), ...(isSerializableHeaderValue(input.BucketKeyEnabled) && { "x-amz-server-side-encryption-bucket-key-enabled": input.BucketKeyEnabled.toString(), }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer }), ...(isSerializableHeaderValue(input.Tagging) && { "x-amz-tagging": input.Tagging }), ...(isSerializableHeaderValue(input.ObjectLockMode) && { "x-amz-object-lock-mode": input.ObjectLockMode }), ...(isSerializableHeaderValue(input.ObjectLockRetainUntilDate) && { "x-amz-object-lock-retain-until-date": (input.ObjectLockRetainUntilDate.toISOString().split(".")[0] + "Z").toString(), }), ...(isSerializableHeaderValue(input.ObjectLockLegalHoldStatus) && { "x-amz-object-lock-legal-hold": input.ObjectLockLegalHoldStatus, }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), ...(input.Metadata !== undefined && Object.keys(input.Metadata).reduce((acc, suffix) => ({ ...acc, [`x-amz-meta-${suffix.toLowerCase()}`]: input.Metadata[suffix], }), {})), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } if (input.Key !== undefined) { const labelValue = input.Key; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Key."); } resolvedPath = resolvedPath.replace("{Key+}", labelValue .split("/") .map((segment) => smithy_client_1.extendedEncodeURIComponent(segment)) .join("/")); } else { throw new Error("No value provided for input HTTP label: Key."); } const query = { uploads: "", "x-id": "CreateMultipartUpload", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlCreateMultipartUploadCommand = serializeAws_restXmlCreateMultipartUploadCommand; const serializeAws_restXmlDeleteBucketCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, body, }); }; exports.serializeAws_restXmlDeleteBucketCommand = serializeAws_restXmlDeleteBucketCommand; const serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { analytics: "", ...(input.Id !== undefined && { id: input.Id }), }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand; const serializeAws_restXmlDeleteBucketCorsCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { cors: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketCorsCommand = serializeAws_restXmlDeleteBucketCorsCommand; const serializeAws_restXmlDeleteBucketEncryptionCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { encryption: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketEncryptionCommand = serializeAws_restXmlDeleteBucketEncryptionCommand; const serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { "intelligent-tiering": "", ...(input.Id !== undefined && { id: input.Id }), }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand = serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand; const serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { inventory: "", ...(input.Id !== undefined && { id: input.Id }), }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = serializeAws_restXmlDeleteBucketInventoryConfigurationCommand; const serializeAws_restXmlDeleteBucketLifecycleCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { lifecycle: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketLifecycleCommand = serializeAws_restXmlDeleteBucketLifecycleCommand; const serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { metrics: "", ...(input.Id !== undefined && { id: input.Id }), }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = serializeAws_restXmlDeleteBucketMetricsConfigurationCommand; const serializeAws_restXmlDeleteBucketOwnershipControlsCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { ownershipControls: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketOwnershipControlsCommand = serializeAws_restXmlDeleteBucketOwnershipControlsCommand; const serializeAws_restXmlDeleteBucketPolicyCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { policy: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketPolicyCommand = serializeAws_restXmlDeleteBucketPolicyCommand; const serializeAws_restXmlDeleteBucketReplicationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { replication: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketReplicationCommand = serializeAws_restXmlDeleteBucketReplicationCommand; const serializeAws_restXmlDeleteBucketTaggingCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { tagging: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketTaggingCommand = serializeAws_restXmlDeleteBucketTaggingCommand; const serializeAws_restXmlDeleteBucketWebsiteCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } const query = { website: "", }; let body; return new protocol_http_1.HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, query, body, }); }; exports.serializeAws_restXmlDeleteBucketWebsiteCommand = serializeAws_restXmlDeleteBucketWebsiteCommand; const serializeAws_restXmlDeleteObjectCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { ...(isSerializableHeaderValue(input.MFA) && { "x-amz-mfa": input.MFA }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer }), ...(isSerializableHeaderValue(input.BypassGovernanceRetention) && { "x-amz-bypass-governance-retention": input.BypassGovernanceRetention.toString(), }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner, }), }; let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue = input.Bucket; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: Bucket."); } resolvedPath = resolvedPath.replace("{Bucket}", smithy_client_1.extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: Bucket."); } if (input.Key !== un