@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.
779 lines • 691 kB
JavaScript
import { __assign, __awaiter, __generator } from "tslib";
import { HttpRequest as __HttpRequest, isValidHostname as __isValidHostname, } from "@aws-sdk/protocol-http";
import { dateToUtcString as __dateToUtcString, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, extendedEncodeURIComponent as __extendedEncodeURIComponent, getArrayIfSingleItem as __getArrayIfSingleItem, getValueFromTextNode as __getValueFromTextNode, parseBoolean as __parseBoolean, parseRfc3339DateTime as __parseRfc3339DateTime, parseRfc7231DateTime as __parseRfc7231DateTime, strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, } from "@aws-sdk/smithy-client";
import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder";
import { decodeHTML } from "entities";
import { parse as xmlParse } from "fast-xml-parser";
import { AnalyticsFilter, LifecycleRuleFilter, MetricsFilter, ReplicationRuleFilter, } from "../models/models_0";
export var serializeAws_restXmlAbortMultipartUploadCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign(__assign({}, (isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer })), (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}/{Key+}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
if (input.Key !== undefined) {
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(function (segment) { return __extendedEncodeURIComponent(segment); })
.join("/"));
}
else {
throw new Error("No value provided for input HTTP label: Key.");
}
query = __assign({ "x-id": "AbortMultipartUpload" }, (input.UploadId !== undefined && { uploadId: input.UploadId }));
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlCompleteMultipartUploadCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, query, body, contents;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign(__assign({ "content-type": "application/xml" }, (isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer })), (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}/{Key+}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
if (input.Key !== undefined) {
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(function (segment) { return __extendedEncodeURIComponent(segment); })
.join("/"));
}
else {
throw new Error("No value provided for input HTTP label: Key.");
}
query = __assign({ "x-id": "CompleteMultipartUpload" }, (input.UploadId !== undefined && { uploadId: input.UploadId }));
if (input.MultipartUpload !== undefined) {
body = serializeAws_restXmlCompletedMultipartUpload(input.MultipartUpload, context);
}
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 [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "POST",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlCopyObjectCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (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": __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": __dateToUtcString(input.CopySourceIfUnmodifiedSince).toString(),
})), (isSerializableHeaderValue(input.Expires) && { expires: __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(function (acc, suffix) {
var _a;
return (__assign(__assign({}, acc), (_a = {}, _a["x-amz-meta-" + suffix.toLowerCase()] = input.Metadata[suffix], _a)));
}, {})));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}/{Key+}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
if (input.Key !== undefined) {
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(function (segment) { return __extendedEncodeURIComponent(segment); })
.join("/"));
}
else {
throw new Error("No value provided for input HTTP label: Key.");
}
query = {
"x-id": "CopyObject",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "PUT",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlCreateBucketCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body, contents;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ "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 }));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
if (input.CreateBucketConfiguration !== undefined) {
body = serializeAws_restXmlCreateBucketConfiguration(input.CreateBucketConfiguration, context);
}
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 [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "PUT",
headers: headers,
path: resolvedPath,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlCreateMultipartUploadCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (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: __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(function (acc, suffix) {
var _a;
return (__assign(__assign({}, acc), (_a = {}, _a["x-amz-meta-" + suffix.toLowerCase()] = input.Metadata[suffix], _a)));
}, {})));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}/{Key+}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
if (input.Key !== undefined) {
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(function (segment) { return __extendedEncodeURIComponent(segment); })
.join("/"));
}
else {
throw new Error("No value provided for input HTTP label: Key.");
}
query = {
uploads: "",
"x-id": "CreateMultipartUpload",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "POST",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = __assign({ analytics: "" }, (input.Id !== undefined && { id: input.Id }));
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketCorsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
cors: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketEncryptionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
encryption: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = {};
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = __assign({ "intelligent-tiering": "" }, (input.Id !== undefined && { id: input.Id }));
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = __assign({ inventory: "" }, (input.Id !== undefined && { id: input.Id }));
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketLifecycleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
lifecycle: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = __assign({ metrics: "" }, (input.Id !== undefined && { id: input.Id }));
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketOwnershipControlsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
ownershipControls: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
policy: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketReplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
replication: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketTaggingCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
tagging: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "DELETE",
headers: headers,
path: resolvedPath,
query: query,
body: body,
})];
}
});
}); };
export var serializeAws_restXmlDeleteBucketWebsiteCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, context.endpoint()];
case 1:
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
headers = __assign({}, (isSerializableHeaderValue(input.ExpectedBucketOwner) && {
"x-amz-expected-bucket-owner": input.ExpectedBucketOwner,
}));
resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Bucket}";
if (input.Bucket !== undefined) {
labelValue = input.Bucket;
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: Bucket.");
}
resolvedPath = resolvedPath.replace("{Bucket}", __extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: Bucket.");
}
query = {
website: "",
};
return [2, new __HttpRequest({
protocol: protocol,
hostname: hostname,
port: port,
method: "D