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.

823 lines 1.98 MB
import { __assign, __awaiter, __generator, __read } from "tslib"; import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http"; import { expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, extendedEncodeURIComponent as __extendedEncodeURIComponent, limitedParseDouble as __limitedParseDouble, parseEpochTimestamp as __parseEpochTimestamp, serializeFloat as __serializeFloat, } from "@aws-sdk/smithy-client"; import { v4 as generateIdempotencyToken } from "uuid"; import { AssetPropertyVariant, } from "../models/models_0"; export var serializeAws_restJson1AcceptCertificateTransferCommand = 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 || "") + "/accept-certificate-transfer/{certificateId}"; if (input.certificateId !== undefined) { labelValue = input.certificateId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: certificateId."); } resolvedPath = resolvedPath.replace("{certificateId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: certificateId."); } query = __assign({}, (input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() })); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PATCH", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1AddThingToBillingGroupCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/billing-groups/addThingToBillingGroup"; body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.billingGroupArn !== undefined && input.billingGroupArn !== null && { billingGroupArn: input.billingGroupArn })), (input.billingGroupName !== undefined && input.billingGroupName !== null && { billingGroupName: input.billingGroupName })), (input.thingArn !== undefined && input.thingArn !== null && { thingArn: input.thingArn })), (input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1AddThingToThingGroupCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/thing-groups/addThingToThingGroup"; body = JSON.stringify(__assign(__assign(__assign(__assign(__assign({}, (input.overrideDynamicGroups !== undefined && input.overrideDynamicGroups !== null && { overrideDynamicGroups: input.overrideDynamicGroups })), (input.thingArn !== undefined && input.thingArn !== null && { thingArn: input.thingArn })), (input.thingGroupArn !== undefined && input.thingGroupArn !== null && { thingGroupArn: input.thingGroupArn })), (input.thingGroupName !== undefined && input.thingGroupName !== null && { thingGroupName: input.thingGroupName })), (input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1AssociateTargetsWithJobCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/jobs/{jobId}/targets"; if (input.jobId !== undefined) { labelValue = input.jobId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: jobId."); } resolvedPath = resolvedPath.replace("{jobId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: jobId."); } query = __assign({}, (input.namespaceId !== undefined && { namespaceId: input.namespaceId })); body = JSON.stringify(__assign(__assign({}, (input.comment !== undefined && input.comment !== null && { comment: input.comment })), (input.targets !== undefined && input.targets !== null && { targets: serializeAws_restJson1JobTargets(input.targets, context) }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1AttachPolicyCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/target-policies/{policyName}"; if (input.policyName !== undefined) { labelValue = input.policyName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: policyName."); } resolvedPath = resolvedPath.replace("{policyName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: policyName."); } body = JSON.stringify(__assign({}, (input.target !== undefined && input.target !== null && { target: input.target }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1AttachPrincipalPolicyCommand = 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.principal) && { "x-amzn-iot-principal": input.principal })); resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/principal-policies/{policyName}"; if (input.policyName !== undefined) { labelValue = input.policyName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: policyName."); } resolvedPath = resolvedPath.replace("{policyName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: policyName."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1AttachSecurityProfileCommand = 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 || "") + "/security-profiles/{securityProfileName}/targets"; if (input.securityProfileName !== undefined) { labelValue = input.securityProfileName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: securityProfileName."); } resolvedPath = resolvedPath.replace("{securityProfileName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: securityProfileName."); } query = __assign({}, (input.securityProfileTargetArn !== undefined && { securityProfileTargetArn: input.securityProfileTargetArn })); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1AttachThingPrincipalCommand = 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.principal) && { "x-amzn-principal": input.principal })); resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/principals"; if (input.thingName !== undefined) { labelValue = input.thingName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: thingName."); } resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: thingName."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelAuditMitigationActionsTaskCommand = 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 = {}; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/audit/mitigationactions/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { labelValue = input.taskId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: taskId."); } resolvedPath = resolvedPath.replace("{taskId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: taskId."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelAuditTaskCommand = 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 = {}; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/audit/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { labelValue = input.taskId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: taskId."); } resolvedPath = resolvedPath.replace("{taskId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: taskId."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelCertificateTransferCommand = 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 = {}; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/cancel-certificate-transfer/{certificateId}"; if (input.certificateId !== undefined) { labelValue = input.certificateId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: certificateId."); } resolvedPath = resolvedPath.replace("{certificateId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: certificateId."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PATCH", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelDetectMitigationActionsTaskCommand = 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 = {}; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/detect/mitigationactions/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { labelValue = input.taskId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: taskId."); } resolvedPath = resolvedPath.replace("{taskId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: taskId."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelJobCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/jobs/{jobId}/cancel"; if (input.jobId !== undefined) { labelValue = input.jobId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: jobId."); } resolvedPath = resolvedPath.replace("{jobId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: jobId."); } query = __assign({}, (input.force !== undefined && { force: input.force.toString() })); body = JSON.stringify(__assign(__assign({}, (input.comment !== undefined && input.comment !== null && { comment: input.comment })), (input.reasonCode !== undefined && input.reasonCode !== null && { reasonCode: input.reasonCode }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1CancelJobExecutionCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/jobs/{jobId}/cancel"; if (input.jobId !== undefined) { labelValue = input.jobId; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: jobId."); } resolvedPath = resolvedPath.replace("{jobId}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: jobId."); } if (input.thingName !== undefined) { labelValue = input.thingName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: thingName."); } resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: thingName."); } query = __assign({}, (input.force !== undefined && { force: input.force.toString() })); body = JSON.stringify(__assign(__assign({}, (input.expectedVersion !== undefined && input.expectedVersion !== null && { expectedVersion: input.expectedVersion })), (input.statusDetails !== undefined && input.statusDetails !== null && { statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context), }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "PUT", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1ClearDefaultAuthorizerCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/default-authorizer"; body = ""; return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "DELETE", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1ConfirmTopicRuleDestinationCommand = 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 = {}; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/confirmdestination/{confirmationToken+}"; if (input.confirmationToken !== undefined) { labelValue = input.confirmationToken; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: confirmationToken."); } resolvedPath = resolvedPath.replace("{confirmationToken+}", labelValue .split("/") .map(function (segment) { return __extendedEncodeURIComponent(segment); }) .join("/")); } else { throw new Error("No value provided for input HTTP label: confirmationToken."); } return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "GET", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateAuditSuppressionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body; var _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4, context.endpoint()]; case 1: _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path; headers = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/audit/suppressions/create"; body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName })), { clientRequestToken: (_c = input.clientRequestToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }), (input.description !== undefined && input.description !== null && { description: input.description })), (input.expirationDate !== undefined && input.expirationDate !== null && { expirationDate: Math.round(input.expirationDate.getTime() / 1000) })), (input.resourceIdentifier !== undefined && input.resourceIdentifier !== null && { resourceIdentifier: serializeAws_restJson1ResourceIdentifier(input.resourceIdentifier, context), })), (input.suppressIndefinitely !== undefined && input.suppressIndefinitely !== null && { suppressIndefinitely: input.suppressIndefinitely }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateAuthorizerCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/authorizer/{authorizerName}"; if (input.authorizerName !== undefined) { labelValue = input.authorizerName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: authorizerName."); } resolvedPath = resolvedPath.replace("{authorizerName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: authorizerName."); } body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.authorizerFunctionArn !== undefined && input.authorizerFunctionArn !== null && { authorizerFunctionArn: input.authorizerFunctionArn })), (input.enableCachingForHttp !== undefined && input.enableCachingForHttp !== null && { enableCachingForHttp: input.enableCachingForHttp })), (input.signingDisabled !== undefined && input.signingDisabled !== null && { signingDisabled: input.signingDisabled })), (input.status !== undefined && input.status !== null && { status: input.status })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) })), (input.tokenKeyName !== undefined && input.tokenKeyName !== null && { tokenKeyName: input.tokenKeyName })), (input.tokenSigningPublicKeys !== undefined && input.tokenSigningPublicKeys !== null && { tokenSigningPublicKeys: serializeAws_restJson1PublicKeyMap(input.tokenSigningPublicKeys, context), }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateBillingGroupCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/billing-groups/{billingGroupName}"; if (input.billingGroupName !== undefined) { labelValue = input.billingGroupName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: billingGroupName."); } resolvedPath = resolvedPath.replace("{billingGroupName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: billingGroupName."); } body = JSON.stringify(__assign(__assign({}, (input.billingGroupProperties !== undefined && input.billingGroupProperties !== null && { billingGroupProperties: serializeAws_restJson1BillingGroupProperties(input.billingGroupProperties, context), })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateCertificateFromCsrCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/certificates"; query = __assign({}, (input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() })); body = JSON.stringify(__assign({}, (input.certificateSigningRequest !== undefined && input.certificateSigningRequest !== null && { certificateSigningRequest: input.certificateSigningRequest }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, query: query, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateCustomMetricCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body; var _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4, context.endpoint()]; case 1: _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path; headers = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/custom-metric/{metricName}"; if (input.metricName !== undefined) { labelValue = input.metricName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: metricName."); } resolvedPath = resolvedPath.replace("{metricName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: metricName."); } body = JSON.stringify(__assign(__assign(__assign({ clientRequestToken: (_c = input.clientRequestToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.displayName !== undefined && input.displayName !== null && { displayName: input.displayName })), (input.metricType !== undefined && input.metricType !== null && { metricType: input.metricType })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateDimensionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body; var _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4, context.endpoint()]; case 1: _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path; headers = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/dimensions/{name}"; if (input.name !== undefined) { labelValue = input.name; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: name."); } resolvedPath = resolvedPath.replace("{name}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: name."); } body = JSON.stringify(__assign(__assign(__assign({ clientRequestToken: (_c = input.clientRequestToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.stringValues !== undefined && input.stringValues !== null && { stringValues: serializeAws_restJson1DimensionStringValues(input.stringValues, context), })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) })), (input.type !== undefined && input.type !== null && { type: input.type }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateDomainConfigurationCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/domainConfigurations/{domainConfigurationName}"; if (input.domainConfigurationName !== undefined) { labelValue = input.domainConfigurationName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: domainConfigurationName."); } resolvedPath = resolvedPath.replace("{domainConfigurationName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: domainConfigurationName."); } body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.authorizerConfig !== undefined && input.authorizerConfig !== null && { authorizerConfig: serializeAws_restJson1AuthorizerConfig(input.authorizerConfig, context), })), (input.domainName !== undefined && input.domainName !== null && { domainName: input.domainName })), (input.serverCertificateArns !== undefined && input.serverCertificateArns !== null && { serverCertificateArns: serializeAws_restJson1ServerCertificateArns(input.serverCertificateArns, context), })), (input.serviceType !== undefined && input.serviceType !== null && { serviceType: input.serviceType })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) })), (input.validationCertificateArn !== undefined && input.validationCertificateArn !== null && { validationCertificateArn: input.validationCertificateArn }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateDynamicThingGroupCommand = 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 = { "content-type": "application/json", }; resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/dynamic-thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { labelValue = input.thingGroupName; if (labelValue.length <= 0) { throw new Error("Empty value provided for input HTTP label: thingGroupName."); } resolvedPath = resolvedPath.replace("{thingGroupName}", __extendedEncodeURIComponent(labelValue)); } else { throw new Error("No value provided for input HTTP label: thingGroupName."); } body = JSON.stringify(__assign(__assign(__assign(__assign(__assign({}, (input.indexName !== undefined && input.indexName !== null && { indexName: input.indexName })), (input.queryString !== undefined && input.queryString !== null && { queryString: input.queryString })), (input.queryVersion !== undefined && input.queryVersion !== null && { queryVersion: input.queryVersion })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) })), (input.thingGroupProperties !== undefined && input.thingGroupProperties !== null && { thingGroupProperties: serializeAws_restJson1ThingGroupProperties(input.thingGroupProperties, context), }))); return [2, new __HttpRequest({ protocol: protocol, hostname: hostname, port: port, method: "POST", headers: headers, path: resolvedPath, body: body, })]; } }); }); }; export var serializeAws_restJson1CreateFleetMetricCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () { var _a, hostname, _b, protocol, port