import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
import { v4 as generateIdempotencyToken } from "uuid";
import { AlreadyExistsException, AssociatedInstances, AssociationAlreadyExists, AssociationDoesNotExist, AssociationExecutionDoesNotExist, AssociationLimitExceeded, AutomationExecutionNotFoundException, DocumentAlreadyExists, DocumentLimitExceeded, DoesNotExistException, DuplicateInstanceId, IdempotentParameterMismatch, InternalServerError, InvalidActivation, InvalidActivationId, InvalidAssociationVersion, InvalidCommandId, InvalidDeleteInventoryParametersException, InvalidDeletionIdException, InvalidDocument, InvalidDocumentContent, InvalidDocumentOperation, InvalidDocumentSchemaVersion, InvalidDocumentVersion, InvalidFilter, InvalidFilterKey, InvalidFilterValue, InvalidInstanceId, InvalidInstanceInformationFilterValue, InvalidInventoryRequestException, InvalidNextToken, InvalidOptionException, InvalidOutputLocation, InvalidParameters, InvalidPermissionType, InvalidResourceId, InvalidResourceType, InvalidSchedule, InvalidTag, InvalidTarget, InvalidTargetMaps, InvalidTypeNameException, MaxDocumentSizeExceeded, OpsItemAccessDeniedException, OpsItemAlreadyExistsException, OpsItemConflictException, OpsItemInvalidParameterException, OpsItemLimitExceededException, OpsItemNotFoundException, OpsItemRelatedItemAlreadyExistsException, OpsMetadataAlreadyExistsException, OpsMetadataInvalidArgumentException, OpsMetadataLimitExceededException, OpsMetadataNotFoundException, OpsMetadataTooManyUpdatesException, ParameterNotFound, ResourceDataSyncAlreadyExistsException, ResourceDataSyncCountExceededException, ResourceDataSyncInvalidConfigurationException, ResourceDataSyncNotFoundException, ResourceInUseException, ResourceLimitExceededException, ResourcePolicyConflictException, ResourcePolicyInvalidParameterException, TargetInUseException, TooManyTagsError, TooManyUpdates, UnsupportedOperatingSystem, UnsupportedPlatformType, } from "../models/models_0";
import { AutomationDefinitionNotApprovedException, AutomationDefinitionNotFoundException, AutomationDefinitionVersionNotFoundException, AutomationExecutionLimitExceededException, AutomationStepNotFoundException, ComplianceTypeCountLimitExceededException, CustomSchemaCountLimitExceededException, DocumentPermissionLimit, FeatureNotAvailableException, HierarchyLevelLimitExceededException, HierarchyTypeMismatchException, IncompatiblePolicyException, InvalidAggregatorException, InvalidAllowedPatternException, InvalidAssociation, InvalidAutomationExecutionParametersException, InvalidAutomationSignalException, InvalidAutomationStatusUpdateException, InvalidDocumentType, InvalidFilterOption, InvalidInventoryGroupException, InvalidInventoryItemContextException, InvalidItemContentException, InvalidKeyId, InvalidNotificationConfig, InvalidOutputFolder, InvalidPluginName, InvalidPolicyAttributeException, InvalidPolicyTypeException, InvalidResultAttributeException, InvalidRole, InvocationDoesNotExist, ItemContentMismatchException, ItemSizeLimitExceededException, OpsItemRelatedItemAssociationNotFoundException, ParameterAlreadyExists, ParameterLimitExceeded, ParameterMaxVersionLimitExceeded, ParameterPatternMismatchException, ParameterVersionLabelLimitExceeded, ParameterVersionNotFound, PoliciesLimitExceededException, ResourcePolicyLimitExceededException, ServiceSettingNotFound, SubTypeCountLimitExceededException, TargetNotConnected, TotalSizeLimitExceededException, UnsupportedCalendarException, UnsupportedFeatureRequiredException, UnsupportedInventoryItemContextException, UnsupportedInventorySchemaVersionException, UnsupportedParameterType, } from "../models/models_1";
import { AssociationVersionLimitExceeded, DocumentVersionLimitExceeded, DuplicateDocumentContent, DuplicateDocumentVersionName, InvalidUpdate, OpsMetadataKeyLimitExceededException, ResourceDataSyncConflictException, StatusUnchanged, } from "../models/models_2";
import { SSMServiceException as __BaseException } from "../models/SSMServiceException";
export const se_AddTagsToResourceCommand = async (input, context) => {
    const headers = sharedHeaders("AddTagsToResource");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_AssociateOpsItemRelatedItemCommand = async (input, context) => {
    const headers = sharedHeaders("AssociateOpsItemRelatedItem");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CancelCommandCommand = async (input, context) => {
    const headers = sharedHeaders("CancelCommand");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CancelMaintenanceWindowExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("CancelMaintenanceWindowExecution");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateActivationCommand = async (input, context) => {
    const headers = sharedHeaders("CreateActivation");
    let body;
    body = JSON.stringify(se_CreateActivationRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateAssociationCommand = async (input, context) => {
    const headers = sharedHeaders("CreateAssociation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateAssociationBatchCommand = async (input, context) => {
    const headers = sharedHeaders("CreateAssociationBatch");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateDocumentCommand = async (input, context) => {
    const headers = sharedHeaders("CreateDocument");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("CreateMaintenanceWindow");
    let body;
    body = JSON.stringify(se_CreateMaintenanceWindowRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateOpsItemCommand = async (input, context) => {
    const headers = sharedHeaders("CreateOpsItem");
    let body;
    body = JSON.stringify(se_CreateOpsItemRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateOpsMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("CreateOpsMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreatePatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("CreatePatchBaseline");
    let body;
    body = JSON.stringify(se_CreatePatchBaselineRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_CreateResourceDataSyncCommand = async (input, context) => {
    const headers = sharedHeaders("CreateResourceDataSync");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteActivationCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteActivation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteAssociationCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteAssociation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteDocumentCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteDocument");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteInventoryCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteInventory");
    let body;
    body = JSON.stringify(se_DeleteInventoryRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteMaintenanceWindow");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteOpsItemCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteOpsItem");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteOpsMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteOpsMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteParameterCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteParameter");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteParametersCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteParameters");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeletePatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("DeletePatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteResourceDataSyncCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteResourceDataSync");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteResourcePolicyCommand = async (input, context) => {
    const headers = sharedHeaders("DeleteResourcePolicy");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeregisterManagedInstanceCommand = async (input, context) => {
    const headers = sharedHeaders("DeregisterManagedInstance");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeregisterPatchBaselineForPatchGroupCommand = async (input, context) => {
    const headers = sharedHeaders("DeregisterPatchBaselineForPatchGroup");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeregisterTargetFromMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("DeregisterTargetFromMaintenanceWindow");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeregisterTaskFromMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("DeregisterTaskFromMaintenanceWindow");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeActivationsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeActivations");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAssociationCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAssociation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAssociationExecutionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAssociationExecutions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAssociationExecutionTargetsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAssociationExecutionTargets");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAutomationExecutionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAutomationExecutions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAutomationStepExecutionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAutomationStepExecutions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAvailablePatchesCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeAvailablePatches");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeDocumentCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeDocument");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeDocumentPermissionCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeDocumentPermission");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeEffectiveInstanceAssociationsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeEffectiveInstanceAssociations");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeEffectivePatchesForPatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeEffectivePatchesForPatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInstanceAssociationsStatusCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInstanceAssociationsStatus");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInstanceInformationCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInstanceInformation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInstancePatchesCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInstancePatches");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInstancePatchStatesCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInstancePatchStates");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInstancePatchStatesForPatchGroupCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInstancePatchStatesForPatchGroup");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInventoryDeletionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeInventoryDeletions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowExecutionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowExecutions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowExecutionTaskInvocationsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowExecutionTaskInvocations");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowExecutionTasksCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowExecutionTasks");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindows");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowScheduleCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowSchedule");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowsForTargetCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowsForTarget");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowTargetsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowTargets");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeMaintenanceWindowTasksCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeMaintenanceWindowTasks");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeOpsItemsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeOpsItems");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeParametersCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeParameters");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribePatchBaselinesCommand = async (input, context) => {
    const headers = sharedHeaders("DescribePatchBaselines");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribePatchGroupsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribePatchGroups");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribePatchGroupStateCommand = async (input, context) => {
    const headers = sharedHeaders("DescribePatchGroupState");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribePatchPropertiesCommand = async (input, context) => {
    const headers = sharedHeaders("DescribePatchProperties");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeSessionsCommand = async (input, context) => {
    const headers = sharedHeaders("DescribeSessions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DisassociateOpsItemRelatedItemCommand = async (input, context) => {
    const headers = sharedHeaders("DisassociateOpsItemRelatedItem");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetAutomationExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("GetAutomationExecution");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetCalendarStateCommand = async (input, context) => {
    const headers = sharedHeaders("GetCalendarState");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetCommandInvocationCommand = async (input, context) => {
    const headers = sharedHeaders("GetCommandInvocation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetConnectionStatusCommand = async (input, context) => {
    const headers = sharedHeaders("GetConnectionStatus");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetDefaultPatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("GetDefaultPatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetDeployablePatchSnapshotForInstanceCommand = async (input, context) => {
    const headers = sharedHeaders("GetDeployablePatchSnapshotForInstance");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetDocumentCommand = async (input, context) => {
    const headers = sharedHeaders("GetDocument");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetInventoryCommand = async (input, context) => {
    const headers = sharedHeaders("GetInventory");
    let body;
    body = JSON.stringify(se_GetInventoryRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetInventorySchemaCommand = async (input, context) => {
    const headers = sharedHeaders("GetInventorySchema");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("GetMaintenanceWindow");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMaintenanceWindowExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("GetMaintenanceWindowExecution");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMaintenanceWindowExecutionTaskCommand = async (input, context) => {
    const headers = sharedHeaders("GetMaintenanceWindowExecutionTask");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMaintenanceWindowExecutionTaskInvocationCommand = async (input, context) => {
    const headers = sharedHeaders("GetMaintenanceWindowExecutionTaskInvocation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMaintenanceWindowTaskCommand = async (input, context) => {
    const headers = sharedHeaders("GetMaintenanceWindowTask");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetOpsItemCommand = async (input, context) => {
    const headers = sharedHeaders("GetOpsItem");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetOpsMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("GetOpsMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetOpsSummaryCommand = async (input, context) => {
    const headers = sharedHeaders("GetOpsSummary");
    let body;
    body = JSON.stringify(se_GetOpsSummaryRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetParameterCommand = async (input, context) => {
    const headers = sharedHeaders("GetParameter");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetParameterHistoryCommand = async (input, context) => {
    const headers = sharedHeaders("GetParameterHistory");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetParametersCommand = async (input, context) => {
    const headers = sharedHeaders("GetParameters");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetParametersByPathCommand = async (input, context) => {
    const headers = sharedHeaders("GetParametersByPath");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetPatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("GetPatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetPatchBaselineForPatchGroupCommand = async (input, context) => {
    const headers = sharedHeaders("GetPatchBaselineForPatchGroup");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetResourcePoliciesCommand = async (input, context) => {
    const headers = sharedHeaders("GetResourcePolicies");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetServiceSettingCommand = async (input, context) => {
    const headers = sharedHeaders("GetServiceSetting");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_LabelParameterVersionCommand = async (input, context) => {
    const headers = sharedHeaders("LabelParameterVersion");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListAssociationsCommand = async (input, context) => {
    const headers = sharedHeaders("ListAssociations");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListAssociationVersionsCommand = async (input, context) => {
    const headers = sharedHeaders("ListAssociationVersions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListCommandInvocationsCommand = async (input, context) => {
    const headers = sharedHeaders("ListCommandInvocations");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListCommandsCommand = async (input, context) => {
    const headers = sharedHeaders("ListCommands");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListComplianceItemsCommand = async (input, context) => {
    const headers = sharedHeaders("ListComplianceItems");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListComplianceSummariesCommand = async (input, context) => {
    const headers = sharedHeaders("ListComplianceSummaries");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListDocumentMetadataHistoryCommand = async (input, context) => {
    const headers = sharedHeaders("ListDocumentMetadataHistory");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListDocumentsCommand = async (input, context) => {
    const headers = sharedHeaders("ListDocuments");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListDocumentVersionsCommand = async (input, context) => {
    const headers = sharedHeaders("ListDocumentVersions");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListInventoryEntriesCommand = async (input, context) => {
    const headers = sharedHeaders("ListInventoryEntries");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListOpsItemEventsCommand = async (input, context) => {
    const headers = sharedHeaders("ListOpsItemEvents");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListOpsItemRelatedItemsCommand = async (input, context) => {
    const headers = sharedHeaders("ListOpsItemRelatedItems");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListOpsMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("ListOpsMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListResourceComplianceSummariesCommand = async (input, context) => {
    const headers = sharedHeaders("ListResourceComplianceSummaries");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListResourceDataSyncCommand = async (input, context) => {
    const headers = sharedHeaders("ListResourceDataSync");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListTagsForResourceCommand = async (input, context) => {
    const headers = sharedHeaders("ListTagsForResource");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ModifyDocumentPermissionCommand = async (input, context) => {
    const headers = sharedHeaders("ModifyDocumentPermission");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutComplianceItemsCommand = async (input, context) => {
    const headers = sharedHeaders("PutComplianceItems");
    let body;
    body = JSON.stringify(se_PutComplianceItemsRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutInventoryCommand = async (input, context) => {
    const headers = sharedHeaders("PutInventory");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutParameterCommand = async (input, context) => {
    const headers = sharedHeaders("PutParameter");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutResourcePolicyCommand = async (input, context) => {
    const headers = sharedHeaders("PutResourcePolicy");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_RegisterDefaultPatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("RegisterDefaultPatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_RegisterPatchBaselineForPatchGroupCommand = async (input, context) => {
    const headers = sharedHeaders("RegisterPatchBaselineForPatchGroup");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_RegisterTargetWithMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("RegisterTargetWithMaintenanceWindow");
    let body;
    body = JSON.stringify(se_RegisterTargetWithMaintenanceWindowRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_RegisterTaskWithMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("RegisterTaskWithMaintenanceWindow");
    let body;
    body = JSON.stringify(se_RegisterTaskWithMaintenanceWindowRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_RemoveTagsFromResourceCommand = async (input, context) => {
    const headers = sharedHeaders("RemoveTagsFromResource");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ResetServiceSettingCommand = async (input, context) => {
    const headers = sharedHeaders("ResetServiceSetting");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ResumeSessionCommand = async (input, context) => {
    const headers = sharedHeaders("ResumeSession");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_SendAutomationSignalCommand = async (input, context) => {
    const headers = sharedHeaders("SendAutomationSignal");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_SendCommandCommand = async (input, context) => {
    const headers = sharedHeaders("SendCommand");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StartAssociationsOnceCommand = async (input, context) => {
    const headers = sharedHeaders("StartAssociationsOnce");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StartAutomationExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("StartAutomationExecution");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StartChangeRequestExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("StartChangeRequestExecution");
    let body;
    body = JSON.stringify(se_StartChangeRequestExecutionRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StartSessionCommand = async (input, context) => {
    const headers = sharedHeaders("StartSession");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StopAutomationExecutionCommand = async (input, context) => {
    const headers = sharedHeaders("StopAutomationExecution");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_TerminateSessionCommand = async (input, context) => {
    const headers = sharedHeaders("TerminateSession");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UnlabelParameterVersionCommand = async (input, context) => {
    const headers = sharedHeaders("UnlabelParameterVersion");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateAssociationCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateAssociation");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateAssociationStatusCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateAssociationStatus");
    let body;
    body = JSON.stringify(se_UpdateAssociationStatusRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateDocumentCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateDocument");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateDocumentDefaultVersionCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateDocumentDefaultVersion");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateDocumentMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateDocumentMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateMaintenanceWindowCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateMaintenanceWindow");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateMaintenanceWindowTargetCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateMaintenanceWindowTarget");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateMaintenanceWindowTaskCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateMaintenanceWindowTask");
    let body;
    body = JSON.stringify(se_UpdateMaintenanceWindowTaskRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateManagedInstanceRoleCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateManagedInstanceRole");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateOpsItemCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateOpsItem");
    let body;
    body = JSON.stringify(se_UpdateOpsItemRequest(input, context));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateOpsMetadataCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateOpsMetadata");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdatePatchBaselineCommand = async (input, context) => {
    const headers = sharedHeaders("UpdatePatchBaseline");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateResourceDataSyncCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateResourceDataSync");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UpdateServiceSettingCommand = async (input, context) => {
    const headers = sharedHeaders("UpdateServiceSetting");
    let body;
    body = JSON.stringify(_json(input));
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const de_AddTagsToResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_AddTagsToResourceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_AddTagsToResourceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "InvalidResourceType":
        case "com.amazonaws.ssm#InvalidResourceType":
            throw await de_InvalidResourceTypeRes(parsedOutput, context);
        case "TooManyTagsError":
        case "com.amazonaws.ssm#TooManyTagsError":
            throw await de_TooManyTagsErrorRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_AssociateOpsItemRelatedItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_AssociateOpsItemRelatedItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_AssociateOpsItemRelatedItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemConflictException":
        case "com.amazonaws.ssm#OpsItemConflictException":
            throw await de_OpsItemConflictExceptionRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        case "OpsItemLimitExceededException":
        case "com.amazonaws.ssm#OpsItemLimitExceededException":
            throw await de_OpsItemLimitExceededExceptionRes(parsedOutput, context);
        case "OpsItemNotFoundException":
        case "com.amazonaws.ssm#OpsItemNotFoundException":
            throw await de_OpsItemNotFoundExceptionRes(parsedOutput, context);
        case "OpsItemRelatedItemAlreadyExistsException":
        case "com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":
            throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CancelCommandCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CancelCommandCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CancelCommandCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DuplicateInstanceId":
        case "com.amazonaws.ssm#DuplicateInstanceId":
            throw await de_DuplicateInstanceIdRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidCommandId":
        case "com.amazonaws.ssm#InvalidCommandId":
            throw await de_InvalidCommandIdRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CancelMaintenanceWindowExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CancelMaintenanceWindowExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CancelMaintenanceWindowExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateActivationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateActivationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateActivationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidParameters":
        case "com.amazonaws.ssm#InvalidParameters":
            throw await de_InvalidParametersRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateAssociationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateAssociationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_CreateAssociationResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateAssociationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationAlreadyExists":
        case "com.amazonaws.ssm#AssociationAlreadyExists":
            throw await de_AssociationAlreadyExistsRes(parsedOutput, context);
        case "AssociationLimitExceeded":
        case "com.amazonaws.ssm#AssociationLimitExceeded":
            throw await de_AssociationLimitExceededRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidOutputLocation":
        case "com.amazonaws.ssm#InvalidOutputLocation":
            throw await de_InvalidOutputLocationRes(parsedOutput, context);
        case "InvalidParameters":
        case "com.amazonaws.ssm#InvalidParameters":
            throw await de_InvalidParametersRes(parsedOutput, context);
        case "InvalidSchedule":
        case "com.amazonaws.ssm#InvalidSchedule":
            throw await de_InvalidScheduleRes(parsedOutput, context);
        case "InvalidTag":
        case "com.amazonaws.ssm#InvalidTag":
            throw await de_InvalidTagRes(parsedOutput, context);
        case "InvalidTarget":
        case "com.amazonaws.ssm#InvalidTarget":
            throw await de_InvalidTargetRes(parsedOutput, context);
        case "InvalidTargetMaps":
        case "com.amazonaws.ssm#InvalidTargetMaps":
            throw await de_InvalidTargetMapsRes(parsedOutput, context);
        case "UnsupportedPlatformType":
        case "com.amazonaws.ssm#UnsupportedPlatformType":
            throw await de_UnsupportedPlatformTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateAssociationBatchCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateAssociationBatchCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_CreateAssociationBatchResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateAssociationBatchCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationLimitExceeded":
        case "com.amazonaws.ssm#AssociationLimitExceeded":
            throw await de_AssociationLimitExceededRes(parsedOutput, context);
        case "DuplicateInstanceId":
        case "com.amazonaws.ssm#DuplicateInstanceId":
            throw await de_DuplicateInstanceIdRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidOutputLocation":
        case "com.amazonaws.ssm#InvalidOutputLocation":
            throw await de_InvalidOutputLocationRes(parsedOutput, context);
        case "InvalidParameters":
        case "com.amazonaws.ssm#InvalidParameters":
            throw await de_InvalidParametersRes(parsedOutput, context);
        case "InvalidSchedule":
        case "com.amazonaws.ssm#InvalidSchedule":
            throw await de_InvalidScheduleRes(parsedOutput, context);
        case "InvalidTarget":
        case "com.amazonaws.ssm#InvalidTarget":
            throw await de_InvalidTargetRes(parsedOutput, context);
        case "InvalidTargetMaps":
        case "com.amazonaws.ssm#InvalidTargetMaps":
            throw await de_InvalidTargetMapsRes(parsedOutput, context);
        case "UnsupportedPlatformType":
        case "com.amazonaws.ssm#UnsupportedPlatformType":
            throw await de_UnsupportedPlatformTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateDocumentCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateDocumentCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_CreateDocumentResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateDocumentCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DocumentAlreadyExists":
        case "com.amazonaws.ssm#DocumentAlreadyExists":
            throw await de_DocumentAlreadyExistsRes(parsedOutput, context);
        case "DocumentLimitExceeded":
        case "com.amazonaws.ssm#DocumentLimitExceeded":
            throw await de_DocumentLimitExceededRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocumentContent":
        case "com.amazonaws.ssm#InvalidDocumentContent":
            throw await de_InvalidDocumentContentRes(parsedOutput, context);
        case "InvalidDocumentSchemaVersion":
        case "com.amazonaws.ssm#InvalidDocumentSchemaVersion":
            throw await de_InvalidDocumentSchemaVersionRes(parsedOutput, context);
        case "MaxDocumentSizeExceeded":
        case "com.amazonaws.ssm#MaxDocumentSizeExceeded":
            throw await de_MaxDocumentSizeExceededRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceLimitExceededException":
        case "com.amazonaws.ssm#ResourceLimitExceededException":
            throw await de_ResourceLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateOpsItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateOpsItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateOpsItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemAccessDeniedException":
        case "com.amazonaws.ssm#OpsItemAccessDeniedException":
            throw await de_OpsItemAccessDeniedExceptionRes(parsedOutput, context);
        case "OpsItemAlreadyExistsException":
        case "com.amazonaws.ssm#OpsItemAlreadyExistsException":
            throw await de_OpsItemAlreadyExistsExceptionRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        case "OpsItemLimitExceededException":
        case "com.amazonaws.ssm#OpsItemLimitExceededException":
            throw await de_OpsItemLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateOpsMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateOpsMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateOpsMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsMetadataAlreadyExistsException":
        case "com.amazonaws.ssm#OpsMetadataAlreadyExistsException":
            throw await de_OpsMetadataAlreadyExistsExceptionRes(parsedOutput, context);
        case "OpsMetadataInvalidArgumentException":
        case "com.amazonaws.ssm#OpsMetadataInvalidArgumentException":
            throw await de_OpsMetadataInvalidArgumentExceptionRes(parsedOutput, context);
        case "OpsMetadataLimitExceededException":
        case "com.amazonaws.ssm#OpsMetadataLimitExceededException":
            throw await de_OpsMetadataLimitExceededExceptionRes(parsedOutput, context);
        case "OpsMetadataTooManyUpdatesException":
        case "com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":
            throw await de_OpsMetadataTooManyUpdatesExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreatePatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreatePatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreatePatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceLimitExceededException":
        case "com.amazonaws.ssm#ResourceLimitExceededException":
            throw await de_ResourceLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_CreateResourceDataSyncCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CreateResourceDataSyncCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CreateResourceDataSyncCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceDataSyncAlreadyExistsException":
        case "com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":
            throw await de_ResourceDataSyncAlreadyExistsExceptionRes(parsedOutput, context);
        case "ResourceDataSyncCountExceededException":
        case "com.amazonaws.ssm#ResourceDataSyncCountExceededException":
            throw await de_ResourceDataSyncCountExceededExceptionRes(parsedOutput, context);
        case "ResourceDataSyncInvalidConfigurationException":
        case "com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":
            throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteActivationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteActivationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteActivationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidActivation":
        case "com.amazonaws.ssm#InvalidActivation":
            throw await de_InvalidActivationRes(parsedOutput, context);
        case "InvalidActivationId":
        case "com.amazonaws.ssm#InvalidActivationId":
            throw await de_InvalidActivationIdRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteAssociationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteAssociationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteAssociationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteDocumentCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteDocumentCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteDocumentCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociatedInstances":
        case "com.amazonaws.ssm#AssociatedInstances":
            throw await de_AssociatedInstancesRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentOperation":
        case "com.amazonaws.ssm#InvalidDocumentOperation":
            throw await de_InvalidDocumentOperationRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteInventoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteInventoryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteInventoryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDeleteInventoryParametersException":
        case "com.amazonaws.ssm#InvalidDeleteInventoryParametersException":
            throw await de_InvalidDeleteInventoryParametersExceptionRes(parsedOutput, context);
        case "InvalidInventoryRequestException":
        case "com.amazonaws.ssm#InvalidInventoryRequestException":
            throw await de_InvalidInventoryRequestExceptionRes(parsedOutput, context);
        case "InvalidOptionException":
        case "com.amazonaws.ssm#InvalidOptionException":
            throw await de_InvalidOptionExceptionRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteOpsItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteOpsItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteOpsItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteOpsMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteOpsMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteOpsMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsMetadataInvalidArgumentException":
        case "com.amazonaws.ssm#OpsMetadataInvalidArgumentException":
            throw await de_OpsMetadataInvalidArgumentExceptionRes(parsedOutput, context);
        case "OpsMetadataNotFoundException":
        case "com.amazonaws.ssm#OpsMetadataNotFoundException":
            throw await de_OpsMetadataNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteParameterCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteParameterCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteParameterCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ParameterNotFound":
        case "com.amazonaws.ssm#ParameterNotFound":
            throw await de_ParameterNotFoundRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteParametersCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteParametersCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteParametersCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeletePatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeletePatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeletePatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceInUseException":
        case "com.amazonaws.ssm#ResourceInUseException":
            throw await de_ResourceInUseExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteResourceDataSyncCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteResourceDataSyncCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteResourceDataSyncCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceDataSyncInvalidConfigurationException":
        case "com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":
            throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(parsedOutput, context);
        case "ResourceDataSyncNotFoundException":
        case "com.amazonaws.ssm#ResourceDataSyncNotFoundException":
            throw await de_ResourceDataSyncNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeleteResourcePolicyCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeleteResourcePolicyCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeleteResourcePolicyCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourcePolicyConflictException":
        case "com.amazonaws.ssm#ResourcePolicyConflictException":
            throw await de_ResourcePolicyConflictExceptionRes(parsedOutput, context);
        case "ResourcePolicyInvalidParameterException":
        case "com.amazonaws.ssm#ResourcePolicyInvalidParameterException":
            throw await de_ResourcePolicyInvalidParameterExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeregisterManagedInstanceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeregisterManagedInstanceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeregisterManagedInstanceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeregisterPatchBaselineForPatchGroupCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeregisterPatchBaselineForPatchGroupCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeregisterPatchBaselineForPatchGroupCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeregisterTargetFromMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeregisterTargetFromMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeregisterTargetFromMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "TargetInUseException":
        case "com.amazonaws.ssm#TargetInUseException":
            throw await de_TargetInUseExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DeregisterTaskFromMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DeregisterTaskFromMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DeregisterTaskFromMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeActivationsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeActivationsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeActivationsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeActivationsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAssociationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAssociationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAssociationResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAssociationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAssociationVersion":
        case "com.amazonaws.ssm#InvalidAssociationVersion":
            throw await de_InvalidAssociationVersionRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAssociationExecutionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAssociationExecutionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAssociationExecutionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAssociationExecutionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAssociationExecutionTargetsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAssociationExecutionTargetsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAssociationExecutionTargetsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAssociationExecutionTargetsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "AssociationExecutionDoesNotExist":
        case "com.amazonaws.ssm#AssociationExecutionDoesNotExist":
            throw await de_AssociationExecutionDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAutomationExecutionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAutomationExecutionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAutomationExecutionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAutomationExecutionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidFilterValue":
        case "com.amazonaws.ssm#InvalidFilterValue":
            throw await de_InvalidFilterValueRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAutomationStepExecutionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAutomationStepExecutionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAutomationStepExecutionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAutomationStepExecutionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationExecutionNotFoundException":
        case "com.amazonaws.ssm#AutomationExecutionNotFoundException":
            throw await de_AutomationExecutionNotFoundExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidFilterValue":
        case "com.amazonaws.ssm#InvalidFilterValue":
            throw await de_InvalidFilterValueRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeAvailablePatchesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeAvailablePatchesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAvailablePatchesResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeAvailablePatchesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeDocumentCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeDocumentCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeDocumentResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeDocumentCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeDocumentPermissionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeDocumentPermissionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeDocumentPermissionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentOperation":
        case "com.amazonaws.ssm#InvalidDocumentOperation":
            throw await de_InvalidDocumentOperationRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidPermissionType":
        case "com.amazonaws.ssm#InvalidPermissionType":
            throw await de_InvalidPermissionTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeEffectiveInstanceAssociationsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeEffectiveInstanceAssociationsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeEffectiveInstanceAssociationsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeEffectivePatchesForPatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeEffectivePatchesForPatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeEffectivePatchesForPatchBaselineResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeEffectivePatchesForPatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "UnsupportedOperatingSystem":
        case "com.amazonaws.ssm#UnsupportedOperatingSystem":
            throw await de_UnsupportedOperatingSystemRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInstanceAssociationsStatusCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInstanceAssociationsStatusCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInstanceAssociationsStatusResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInstanceAssociationsStatusCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInstanceInformationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInstanceInformationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInstanceInformationResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInstanceInformationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidInstanceInformationFilterValue":
        case "com.amazonaws.ssm#InvalidInstanceInformationFilterValue":
            throw await de_InvalidInstanceInformationFilterValueRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInstancePatchesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInstancePatchesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInstancePatchesResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInstancePatchesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInstancePatchStatesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInstancePatchStatesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInstancePatchStatesResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInstancePatchStatesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInstancePatchStatesForPatchGroupCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInstancePatchStatesForPatchGroupCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInstancePatchStatesForPatchGroupResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInstancePatchStatesForPatchGroupCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeInventoryDeletionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeInventoryDeletionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInventoryDeletionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeInventoryDeletionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDeletionIdException":
        case "com.amazonaws.ssm#InvalidDeletionIdException":
            throw await de_InvalidDeletionIdExceptionRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowExecutionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowExecutionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeMaintenanceWindowExecutionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowExecutionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowExecutionTaskInvocationsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowExecutionTaskInvocationsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeMaintenanceWindowExecutionTaskInvocationsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowExecutionTaskInvocationsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowExecutionTasksCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowExecutionTasksCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeMaintenanceWindowExecutionTasksResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowExecutionTasksCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowScheduleCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowScheduleCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowScheduleCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowsForTargetCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowsForTargetCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowsForTargetCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowTargetsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowTargetsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowTargetsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeMaintenanceWindowTasksCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeMaintenanceWindowTasksCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeMaintenanceWindowTasksCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeOpsItemsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeOpsItemsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeOpsItemsResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeOpsItemsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeParametersCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeParametersCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeParametersResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeParametersCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidFilterOption":
        case "com.amazonaws.ssm#InvalidFilterOption":
            throw await de_InvalidFilterOptionRes(parsedOutput, context);
        case "InvalidFilterValue":
        case "com.amazonaws.ssm#InvalidFilterValue":
            throw await de_InvalidFilterValueRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribePatchBaselinesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribePatchBaselinesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribePatchBaselinesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribePatchGroupsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribePatchGroupsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribePatchGroupsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribePatchGroupStateCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribePatchGroupStateCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribePatchGroupStateCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribePatchPropertiesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribePatchPropertiesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribePatchPropertiesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DescribeSessionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DescribeSessionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeSessionsResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DescribeSessionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_DisassociateOpsItemRelatedItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_DisassociateOpsItemRelatedItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_DisassociateOpsItemRelatedItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemConflictException":
        case "com.amazonaws.ssm#OpsItemConflictException":
            throw await de_OpsItemConflictExceptionRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        case "OpsItemNotFoundException":
        case "com.amazonaws.ssm#OpsItemNotFoundException":
            throw await de_OpsItemNotFoundExceptionRes(parsedOutput, context);
        case "OpsItemRelatedItemAssociationNotFoundException":
        case "com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":
            throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetAutomationExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetAutomationExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetAutomationExecutionResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetAutomationExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationExecutionNotFoundException":
        case "com.amazonaws.ssm#AutomationExecutionNotFoundException":
            throw await de_AutomationExecutionNotFoundExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetCalendarStateCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetCalendarStateCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetCalendarStateCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentType":
        case "com.amazonaws.ssm#InvalidDocumentType":
            throw await de_InvalidDocumentTypeRes(parsedOutput, context);
        case "UnsupportedCalendarException":
        case "com.amazonaws.ssm#UnsupportedCalendarException":
            throw await de_UnsupportedCalendarExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetCommandInvocationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetCommandInvocationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetCommandInvocationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidCommandId":
        case "com.amazonaws.ssm#InvalidCommandId":
            throw await de_InvalidCommandIdRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidPluginName":
        case "com.amazonaws.ssm#InvalidPluginName":
            throw await de_InvalidPluginNameRes(parsedOutput, context);
        case "InvocationDoesNotExist":
        case "com.amazonaws.ssm#InvocationDoesNotExist":
            throw await de_InvocationDoesNotExistRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetConnectionStatusCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetConnectionStatusCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetConnectionStatusCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetDefaultPatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetDefaultPatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetDefaultPatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetDeployablePatchSnapshotForInstanceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetDeployablePatchSnapshotForInstanceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetDeployablePatchSnapshotForInstanceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "UnsupportedFeatureRequiredException":
        case "com.amazonaws.ssm#UnsupportedFeatureRequiredException":
            throw await de_UnsupportedFeatureRequiredExceptionRes(parsedOutput, context);
        case "UnsupportedOperatingSystem":
        case "com.amazonaws.ssm#UnsupportedOperatingSystem":
            throw await de_UnsupportedOperatingSystemRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetDocumentCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetDocumentCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetDocumentResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetDocumentCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetInventoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetInventoryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetInventoryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAggregatorException":
        case "com.amazonaws.ssm#InvalidAggregatorException":
            throw await de_InvalidAggregatorExceptionRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidInventoryGroupException":
        case "com.amazonaws.ssm#InvalidInventoryGroupException":
            throw await de_InvalidInventoryGroupExceptionRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidResultAttributeException":
        case "com.amazonaws.ssm#InvalidResultAttributeException":
            throw await de_InvalidResultAttributeExceptionRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetInventorySchemaCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetInventorySchemaCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetInventorySchemaCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMaintenanceWindowResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetMaintenanceWindowExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetMaintenanceWindowExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMaintenanceWindowExecutionResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetMaintenanceWindowExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetMaintenanceWindowExecutionTaskCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetMaintenanceWindowExecutionTaskCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMaintenanceWindowExecutionTaskResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetMaintenanceWindowExecutionTaskCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetMaintenanceWindowExecutionTaskInvocationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetMaintenanceWindowExecutionTaskInvocationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMaintenanceWindowExecutionTaskInvocationResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetMaintenanceWindowExecutionTaskInvocationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetMaintenanceWindowTaskCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetMaintenanceWindowTaskCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMaintenanceWindowTaskResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetMaintenanceWindowTaskCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetOpsItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetOpsItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetOpsItemResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetOpsItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemAccessDeniedException":
        case "com.amazonaws.ssm#OpsItemAccessDeniedException":
            throw await de_OpsItemAccessDeniedExceptionRes(parsedOutput, context);
        case "OpsItemNotFoundException":
        case "com.amazonaws.ssm#OpsItemNotFoundException":
            throw await de_OpsItemNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetOpsMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetOpsMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetOpsMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsMetadataInvalidArgumentException":
        case "com.amazonaws.ssm#OpsMetadataInvalidArgumentException":
            throw await de_OpsMetadataInvalidArgumentExceptionRes(parsedOutput, context);
        case "OpsMetadataNotFoundException":
        case "com.amazonaws.ssm#OpsMetadataNotFoundException":
            throw await de_OpsMetadataNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetOpsSummaryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetOpsSummaryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetOpsSummaryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAggregatorException":
        case "com.amazonaws.ssm#InvalidAggregatorException":
            throw await de_InvalidAggregatorExceptionRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        case "ResourceDataSyncNotFoundException":
        case "com.amazonaws.ssm#ResourceDataSyncNotFoundException":
            throw await de_ResourceDataSyncNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetParameterCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetParameterCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetParameterResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetParameterCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidKeyId":
        case "com.amazonaws.ssm#InvalidKeyId":
            throw await de_InvalidKeyIdRes(parsedOutput, context);
        case "ParameterNotFound":
        case "com.amazonaws.ssm#ParameterNotFound":
            throw await de_ParameterNotFoundRes(parsedOutput, context);
        case "ParameterVersionNotFound":
        case "com.amazonaws.ssm#ParameterVersionNotFound":
            throw await de_ParameterVersionNotFoundRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetParameterHistoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetParameterHistoryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetParameterHistoryResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetParameterHistoryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidKeyId":
        case "com.amazonaws.ssm#InvalidKeyId":
            throw await de_InvalidKeyIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "ParameterNotFound":
        case "com.amazonaws.ssm#ParameterNotFound":
            throw await de_ParameterNotFoundRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetParametersCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetParametersCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetParametersResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetParametersCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidKeyId":
        case "com.amazonaws.ssm#InvalidKeyId":
            throw await de_InvalidKeyIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetParametersByPathCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetParametersByPathCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetParametersByPathResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetParametersByPathCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidFilterOption":
        case "com.amazonaws.ssm#InvalidFilterOption":
            throw await de_InvalidFilterOptionRes(parsedOutput, context);
        case "InvalidFilterValue":
        case "com.amazonaws.ssm#InvalidFilterValue":
            throw await de_InvalidFilterValueRes(parsedOutput, context);
        case "InvalidKeyId":
        case "com.amazonaws.ssm#InvalidKeyId":
            throw await de_InvalidKeyIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetPatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetPatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetPatchBaselineResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetPatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetPatchBaselineForPatchGroupCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetPatchBaselineForPatchGroupCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetPatchBaselineForPatchGroupCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetResourcePoliciesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetResourcePoliciesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetResourcePoliciesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourcePolicyInvalidParameterException":
        case "com.amazonaws.ssm#ResourcePolicyInvalidParameterException":
            throw await de_ResourcePolicyInvalidParameterExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_GetServiceSettingCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_GetServiceSettingCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetServiceSettingResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_GetServiceSettingCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ServiceSettingNotFound":
        case "com.amazonaws.ssm#ServiceSettingNotFound":
            throw await de_ServiceSettingNotFoundRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_LabelParameterVersionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_LabelParameterVersionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_LabelParameterVersionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ParameterNotFound":
        case "com.amazonaws.ssm#ParameterNotFound":
            throw await de_ParameterNotFoundRes(parsedOutput, context);
        case "ParameterVersionLabelLimitExceeded":
        case "com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":
            throw await de_ParameterVersionLabelLimitExceededRes(parsedOutput, context);
        case "ParameterVersionNotFound":
        case "com.amazonaws.ssm#ParameterVersionNotFound":
            throw await de_ParameterVersionNotFoundRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListAssociationsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListAssociationsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListAssociationsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListAssociationsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListAssociationVersionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListAssociationVersionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListAssociationVersionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListAssociationVersionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListCommandInvocationsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListCommandInvocationsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListCommandInvocationsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListCommandInvocationsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidCommandId":
        case "com.amazonaws.ssm#InvalidCommandId":
            throw await de_InvalidCommandIdRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListCommandsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListCommandsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListCommandsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListCommandsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidCommandId":
        case "com.amazonaws.ssm#InvalidCommandId":
            throw await de_InvalidCommandIdRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListComplianceItemsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListComplianceItemsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListComplianceItemsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListComplianceItemsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "InvalidResourceType":
        case "com.amazonaws.ssm#InvalidResourceType":
            throw await de_InvalidResourceTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListComplianceSummariesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListComplianceSummariesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListComplianceSummariesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListDocumentMetadataHistoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListDocumentMetadataHistoryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListDocumentMetadataHistoryResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListDocumentMetadataHistoryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListDocumentsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListDocumentsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListDocumentsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListDocumentsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilterKey":
        case "com.amazonaws.ssm#InvalidFilterKey":
            throw await de_InvalidFilterKeyRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListDocumentVersionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListDocumentVersionsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListDocumentVersionsResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListDocumentVersionsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListInventoryEntriesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListInventoryEntriesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListInventoryEntriesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListOpsItemEventsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListOpsItemEventsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListOpsItemEventsResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListOpsItemEventsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        case "OpsItemLimitExceededException":
        case "com.amazonaws.ssm#OpsItemLimitExceededException":
            throw await de_OpsItemLimitExceededExceptionRes(parsedOutput, context);
        case "OpsItemNotFoundException":
        case "com.amazonaws.ssm#OpsItemNotFoundException":
            throw await de_OpsItemNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListOpsItemRelatedItemsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListOpsItemRelatedItemsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListOpsItemRelatedItemsResponse(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListOpsItemRelatedItemsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListOpsMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListOpsMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListOpsMetadataResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListOpsMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsMetadataInvalidArgumentException":
        case "com.amazonaws.ssm#OpsMetadataInvalidArgumentException":
            throw await de_OpsMetadataInvalidArgumentExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListResourceComplianceSummariesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListResourceComplianceSummariesCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListResourceComplianceSummariesResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListResourceComplianceSummariesCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidFilter":
        case "com.amazonaws.ssm#InvalidFilter":
            throw await de_InvalidFilterRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListResourceDataSyncCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListResourceDataSyncCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListResourceDataSyncResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListResourceDataSyncCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.ssm#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "ResourceDataSyncInvalidConfigurationException":
        case "com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":
            throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ListTagsForResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ListTagsForResourceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ListTagsForResourceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "InvalidResourceType":
        case "com.amazonaws.ssm#InvalidResourceType":
            throw await de_InvalidResourceTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ModifyDocumentPermissionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ModifyDocumentPermissionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ModifyDocumentPermissionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DocumentLimitExceeded":
        case "com.amazonaws.ssm#DocumentLimitExceeded":
            throw await de_DocumentLimitExceededRes(parsedOutput, context);
        case "DocumentPermissionLimit":
        case "com.amazonaws.ssm#DocumentPermissionLimit":
            throw await de_DocumentPermissionLimitRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidPermissionType":
        case "com.amazonaws.ssm#InvalidPermissionType":
            throw await de_InvalidPermissionTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_PutComplianceItemsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_PutComplianceItemsCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_PutComplianceItemsCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "ComplianceTypeCountLimitExceededException":
        case "com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":
            throw await de_ComplianceTypeCountLimitExceededExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidItemContentException":
        case "com.amazonaws.ssm#InvalidItemContentException":
            throw await de_InvalidItemContentExceptionRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "InvalidResourceType":
        case "com.amazonaws.ssm#InvalidResourceType":
            throw await de_InvalidResourceTypeRes(parsedOutput, context);
        case "ItemSizeLimitExceededException":
        case "com.amazonaws.ssm#ItemSizeLimitExceededException":
            throw await de_ItemSizeLimitExceededExceptionRes(parsedOutput, context);
        case "TotalSizeLimitExceededException":
        case "com.amazonaws.ssm#TotalSizeLimitExceededException":
            throw await de_TotalSizeLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_PutInventoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_PutInventoryCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_PutInventoryCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "CustomSchemaCountLimitExceededException":
        case "com.amazonaws.ssm#CustomSchemaCountLimitExceededException":
            throw await de_CustomSchemaCountLimitExceededExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidInventoryItemContextException":
        case "com.amazonaws.ssm#InvalidInventoryItemContextException":
            throw await de_InvalidInventoryItemContextExceptionRes(parsedOutput, context);
        case "InvalidItemContentException":
        case "com.amazonaws.ssm#InvalidItemContentException":
            throw await de_InvalidItemContentExceptionRes(parsedOutput, context);
        case "InvalidTypeNameException":
        case "com.amazonaws.ssm#InvalidTypeNameException":
            throw await de_InvalidTypeNameExceptionRes(parsedOutput, context);
        case "ItemContentMismatchException":
        case "com.amazonaws.ssm#ItemContentMismatchException":
            throw await de_ItemContentMismatchExceptionRes(parsedOutput, context);
        case "ItemSizeLimitExceededException":
        case "com.amazonaws.ssm#ItemSizeLimitExceededException":
            throw await de_ItemSizeLimitExceededExceptionRes(parsedOutput, context);
        case "SubTypeCountLimitExceededException":
        case "com.amazonaws.ssm#SubTypeCountLimitExceededException":
            throw await de_SubTypeCountLimitExceededExceptionRes(parsedOutput, context);
        case "TotalSizeLimitExceededException":
        case "com.amazonaws.ssm#TotalSizeLimitExceededException":
            throw await de_TotalSizeLimitExceededExceptionRes(parsedOutput, context);
        case "UnsupportedInventoryItemContextException":
        case "com.amazonaws.ssm#UnsupportedInventoryItemContextException":
            throw await de_UnsupportedInventoryItemContextExceptionRes(parsedOutput, context);
        case "UnsupportedInventorySchemaVersionException":
        case "com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":
            throw await de_UnsupportedInventorySchemaVersionExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_PutParameterCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_PutParameterCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_PutParameterCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "HierarchyLevelLimitExceededException":
        case "com.amazonaws.ssm#HierarchyLevelLimitExceededException":
            throw await de_HierarchyLevelLimitExceededExceptionRes(parsedOutput, context);
        case "HierarchyTypeMismatchException":
        case "com.amazonaws.ssm#HierarchyTypeMismatchException":
            throw await de_HierarchyTypeMismatchExceptionRes(parsedOutput, context);
        case "IncompatiblePolicyException":
        case "com.amazonaws.ssm#IncompatiblePolicyException":
            throw await de_IncompatiblePolicyExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAllowedPatternException":
        case "com.amazonaws.ssm#InvalidAllowedPatternException":
            throw await de_InvalidAllowedPatternExceptionRes(parsedOutput, context);
        case "InvalidKeyId":
        case "com.amazonaws.ssm#InvalidKeyId":
            throw await de_InvalidKeyIdRes(parsedOutput, context);
        case "InvalidPolicyAttributeException":
        case "com.amazonaws.ssm#InvalidPolicyAttributeException":
            throw await de_InvalidPolicyAttributeExceptionRes(parsedOutput, context);
        case "InvalidPolicyTypeException":
        case "com.amazonaws.ssm#InvalidPolicyTypeException":
            throw await de_InvalidPolicyTypeExceptionRes(parsedOutput, context);
        case "ParameterAlreadyExists":
        case "com.amazonaws.ssm#ParameterAlreadyExists":
            throw await de_ParameterAlreadyExistsRes(parsedOutput, context);
        case "ParameterLimitExceeded":
        case "com.amazonaws.ssm#ParameterLimitExceeded":
            throw await de_ParameterLimitExceededRes(parsedOutput, context);
        case "ParameterMaxVersionLimitExceeded":
        case "com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":
            throw await de_ParameterMaxVersionLimitExceededRes(parsedOutput, context);
        case "ParameterPatternMismatchException":
        case "com.amazonaws.ssm#ParameterPatternMismatchException":
            throw await de_ParameterPatternMismatchExceptionRes(parsedOutput, context);
        case "PoliciesLimitExceededException":
        case "com.amazonaws.ssm#PoliciesLimitExceededException":
            throw await de_PoliciesLimitExceededExceptionRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        case "UnsupportedParameterType":
        case "com.amazonaws.ssm#UnsupportedParameterType":
            throw await de_UnsupportedParameterTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_PutResourcePolicyCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_PutResourcePolicyCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_PutResourcePolicyCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourcePolicyConflictException":
        case "com.amazonaws.ssm#ResourcePolicyConflictException":
            throw await de_ResourcePolicyConflictExceptionRes(parsedOutput, context);
        case "ResourcePolicyInvalidParameterException":
        case "com.amazonaws.ssm#ResourcePolicyInvalidParameterException":
            throw await de_ResourcePolicyInvalidParameterExceptionRes(parsedOutput, context);
        case "ResourcePolicyLimitExceededException":
        case "com.amazonaws.ssm#ResourcePolicyLimitExceededException":
            throw await de_ResourcePolicyLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_RegisterDefaultPatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_RegisterDefaultPatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_RegisterDefaultPatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_RegisterPatchBaselineForPatchGroupCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_RegisterPatchBaselineForPatchGroupCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_RegisterPatchBaselineForPatchGroupCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AlreadyExistsException":
        case "com.amazonaws.ssm#AlreadyExistsException":
            throw await de_AlreadyExistsExceptionRes(parsedOutput, context);
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "ResourceLimitExceededException":
        case "com.amazonaws.ssm#ResourceLimitExceededException":
            throw await de_ResourceLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_RegisterTargetWithMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_RegisterTargetWithMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_RegisterTargetWithMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceLimitExceededException":
        case "com.amazonaws.ssm#ResourceLimitExceededException":
            throw await de_ResourceLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_RegisterTaskWithMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_RegisterTaskWithMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_RegisterTaskWithMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "FeatureNotAvailableException":
        case "com.amazonaws.ssm#FeatureNotAvailableException":
            throw await de_FeatureNotAvailableExceptionRes(parsedOutput, context);
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceLimitExceededException":
        case "com.amazonaws.ssm#ResourceLimitExceededException":
            throw await de_ResourceLimitExceededExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_RemoveTagsFromResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_RemoveTagsFromResourceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_RemoveTagsFromResourceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidResourceId":
        case "com.amazonaws.ssm#InvalidResourceId":
            throw await de_InvalidResourceIdRes(parsedOutput, context);
        case "InvalidResourceType":
        case "com.amazonaws.ssm#InvalidResourceType":
            throw await de_InvalidResourceTypeRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ResetServiceSettingCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ResetServiceSettingCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ResetServiceSettingResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ResetServiceSettingCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ServiceSettingNotFound":
        case "com.amazonaws.ssm#ServiceSettingNotFound":
            throw await de_ServiceSettingNotFoundRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_ResumeSessionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_ResumeSessionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_ResumeSessionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_SendAutomationSignalCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_SendAutomationSignalCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_SendAutomationSignalCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationExecutionNotFoundException":
        case "com.amazonaws.ssm#AutomationExecutionNotFoundException":
            throw await de_AutomationExecutionNotFoundExceptionRes(parsedOutput, context);
        case "AutomationStepNotFoundException":
        case "com.amazonaws.ssm#AutomationStepNotFoundException":
            throw await de_AutomationStepNotFoundExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAutomationSignalException":
        case "com.amazonaws.ssm#InvalidAutomationSignalException":
            throw await de_InvalidAutomationSignalExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_SendCommandCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_SendCommandCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_SendCommandResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_SendCommandCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DuplicateInstanceId":
        case "com.amazonaws.ssm#DuplicateInstanceId":
            throw await de_DuplicateInstanceIdRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "InvalidNotificationConfig":
        case "com.amazonaws.ssm#InvalidNotificationConfig":
            throw await de_InvalidNotificationConfigRes(parsedOutput, context);
        case "InvalidOutputFolder":
        case "com.amazonaws.ssm#InvalidOutputFolder":
            throw await de_InvalidOutputFolderRes(parsedOutput, context);
        case "InvalidParameters":
        case "com.amazonaws.ssm#InvalidParameters":
            throw await de_InvalidParametersRes(parsedOutput, context);
        case "InvalidRole":
        case "com.amazonaws.ssm#InvalidRole":
            throw await de_InvalidRoleRes(parsedOutput, context);
        case "MaxDocumentSizeExceeded":
        case "com.amazonaws.ssm#MaxDocumentSizeExceeded":
            throw await de_MaxDocumentSizeExceededRes(parsedOutput, context);
        case "UnsupportedPlatformType":
        case "com.amazonaws.ssm#UnsupportedPlatformType":
            throw await de_UnsupportedPlatformTypeRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_StartAssociationsOnceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_StartAssociationsOnceCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_StartAssociationsOnceCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InvalidAssociation":
        case "com.amazonaws.ssm#InvalidAssociation":
            throw await de_InvalidAssociationRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_StartAutomationExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_StartAutomationExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_StartAutomationExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationDefinitionNotFoundException":
        case "com.amazonaws.ssm#AutomationDefinitionNotFoundException":
            throw await de_AutomationDefinitionNotFoundExceptionRes(parsedOutput, context);
        case "AutomationDefinitionVersionNotFoundException":
        case "com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":
            throw await de_AutomationDefinitionVersionNotFoundExceptionRes(parsedOutput, context);
        case "AutomationExecutionLimitExceededException":
        case "com.amazonaws.ssm#AutomationExecutionLimitExceededException":
            throw await de_AutomationExecutionLimitExceededExceptionRes(parsedOutput, context);
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAutomationExecutionParametersException":
        case "com.amazonaws.ssm#InvalidAutomationExecutionParametersException":
            throw await de_InvalidAutomationExecutionParametersExceptionRes(parsedOutput, context);
        case "InvalidTarget":
        case "com.amazonaws.ssm#InvalidTarget":
            throw await de_InvalidTargetRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_StartChangeRequestExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_StartChangeRequestExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_StartChangeRequestExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationDefinitionNotApprovedException":
        case "com.amazonaws.ssm#AutomationDefinitionNotApprovedException":
            throw await de_AutomationDefinitionNotApprovedExceptionRes(parsedOutput, context);
        case "AutomationDefinitionNotFoundException":
        case "com.amazonaws.ssm#AutomationDefinitionNotFoundException":
            throw await de_AutomationDefinitionNotFoundExceptionRes(parsedOutput, context);
        case "AutomationDefinitionVersionNotFoundException":
        case "com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":
            throw await de_AutomationDefinitionVersionNotFoundExceptionRes(parsedOutput, context);
        case "AutomationExecutionLimitExceededException":
        case "com.amazonaws.ssm#AutomationExecutionLimitExceededException":
            throw await de_AutomationExecutionLimitExceededExceptionRes(parsedOutput, context);
        case "IdempotentParameterMismatch":
        case "com.amazonaws.ssm#IdempotentParameterMismatch":
            throw await de_IdempotentParameterMismatchRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAutomationExecutionParametersException":
        case "com.amazonaws.ssm#InvalidAutomationExecutionParametersException":
            throw await de_InvalidAutomationExecutionParametersExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_StartSessionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_StartSessionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_StartSessionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "TargetNotConnected":
        case "com.amazonaws.ssm#TargetNotConnected":
            throw await de_TargetNotConnectedRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_StopAutomationExecutionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_StopAutomationExecutionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_StopAutomationExecutionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AutomationExecutionNotFoundException":
        case "com.amazonaws.ssm#AutomationExecutionNotFoundException":
            throw await de_AutomationExecutionNotFoundExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAutomationStatusUpdateException":
        case "com.amazonaws.ssm#InvalidAutomationStatusUpdateException":
            throw await de_InvalidAutomationStatusUpdateExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_TerminateSessionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_TerminateSessionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_TerminateSessionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UnlabelParameterVersionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UnlabelParameterVersionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UnlabelParameterVersionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ParameterNotFound":
        case "com.amazonaws.ssm#ParameterNotFound":
            throw await de_ParameterNotFoundRes(parsedOutput, context);
        case "ParameterVersionNotFound":
        case "com.amazonaws.ssm#ParameterVersionNotFound":
            throw await de_ParameterVersionNotFoundRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateAssociationCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateAssociationCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UpdateAssociationResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateAssociationCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "AssociationVersionLimitExceeded":
        case "com.amazonaws.ssm#AssociationVersionLimitExceeded":
            throw await de_AssociationVersionLimitExceededRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidAssociationVersion":
        case "com.amazonaws.ssm#InvalidAssociationVersion":
            throw await de_InvalidAssociationVersionRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "InvalidOutputLocation":
        case "com.amazonaws.ssm#InvalidOutputLocation":
            throw await de_InvalidOutputLocationRes(parsedOutput, context);
        case "InvalidParameters":
        case "com.amazonaws.ssm#InvalidParameters":
            throw await de_InvalidParametersRes(parsedOutput, context);
        case "InvalidSchedule":
        case "com.amazonaws.ssm#InvalidSchedule":
            throw await de_InvalidScheduleRes(parsedOutput, context);
        case "InvalidTarget":
        case "com.amazonaws.ssm#InvalidTarget":
            throw await de_InvalidTargetRes(parsedOutput, context);
        case "InvalidTargetMaps":
        case "com.amazonaws.ssm#InvalidTargetMaps":
            throw await de_InvalidTargetMapsRes(parsedOutput, context);
        case "InvalidUpdate":
        case "com.amazonaws.ssm#InvalidUpdate":
            throw await de_InvalidUpdateRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateAssociationStatusCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateAssociationStatusCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UpdateAssociationStatusResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateAssociationStatusCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "AssociationDoesNotExist":
        case "com.amazonaws.ssm#AssociationDoesNotExist":
            throw await de_AssociationDoesNotExistRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        case "StatusUnchanged":
        case "com.amazonaws.ssm#StatusUnchanged":
            throw await de_StatusUnchangedRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateDocumentCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateDocumentCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UpdateDocumentResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateDocumentCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DocumentVersionLimitExceeded":
        case "com.amazonaws.ssm#DocumentVersionLimitExceeded":
            throw await de_DocumentVersionLimitExceededRes(parsedOutput, context);
        case "DuplicateDocumentContent":
        case "com.amazonaws.ssm#DuplicateDocumentContent":
            throw await de_DuplicateDocumentContentRes(parsedOutput, context);
        case "DuplicateDocumentVersionName":
        case "com.amazonaws.ssm#DuplicateDocumentVersionName":
            throw await de_DuplicateDocumentVersionNameRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentContent":
        case "com.amazonaws.ssm#InvalidDocumentContent":
            throw await de_InvalidDocumentContentRes(parsedOutput, context);
        case "InvalidDocumentOperation":
        case "com.amazonaws.ssm#InvalidDocumentOperation":
            throw await de_InvalidDocumentOperationRes(parsedOutput, context);
        case "InvalidDocumentSchemaVersion":
        case "com.amazonaws.ssm#InvalidDocumentSchemaVersion":
            throw await de_InvalidDocumentSchemaVersionRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        case "MaxDocumentSizeExceeded":
        case "com.amazonaws.ssm#MaxDocumentSizeExceeded":
            throw await de_MaxDocumentSizeExceededRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateDocumentDefaultVersionCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateDocumentDefaultVersionCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateDocumentDefaultVersionCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentSchemaVersion":
        case "com.amazonaws.ssm#InvalidDocumentSchemaVersion":
            throw await de_InvalidDocumentSchemaVersionRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateDocumentMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateDocumentMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateDocumentMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidDocument":
        case "com.amazonaws.ssm#InvalidDocument":
            throw await de_InvalidDocumentRes(parsedOutput, context);
        case "InvalidDocumentOperation":
        case "com.amazonaws.ssm#InvalidDocumentOperation":
            throw await de_InvalidDocumentOperationRes(parsedOutput, context);
        case "InvalidDocumentVersion":
        case "com.amazonaws.ssm#InvalidDocumentVersion":
            throw await de_InvalidDocumentVersionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateMaintenanceWindowCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateMaintenanceWindowCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateMaintenanceWindowCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateMaintenanceWindowTargetCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateMaintenanceWindowTargetCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateMaintenanceWindowTargetCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateMaintenanceWindowTaskCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateMaintenanceWindowTaskCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UpdateMaintenanceWindowTaskResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateMaintenanceWindowTaskCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateManagedInstanceRoleCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateManagedInstanceRoleCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateManagedInstanceRoleCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "InvalidInstanceId":
        case "com.amazonaws.ssm#InvalidInstanceId":
            throw await de_InvalidInstanceIdRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateOpsItemCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateOpsItemCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateOpsItemCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsItemAccessDeniedException":
        case "com.amazonaws.ssm#OpsItemAccessDeniedException":
            throw await de_OpsItemAccessDeniedExceptionRes(parsedOutput, context);
        case "OpsItemAlreadyExistsException":
        case "com.amazonaws.ssm#OpsItemAlreadyExistsException":
            throw await de_OpsItemAlreadyExistsExceptionRes(parsedOutput, context);
        case "OpsItemConflictException":
        case "com.amazonaws.ssm#OpsItemConflictException":
            throw await de_OpsItemConflictExceptionRes(parsedOutput, context);
        case "OpsItemInvalidParameterException":
        case "com.amazonaws.ssm#OpsItemInvalidParameterException":
            throw await de_OpsItemInvalidParameterExceptionRes(parsedOutput, context);
        case "OpsItemLimitExceededException":
        case "com.amazonaws.ssm#OpsItemLimitExceededException":
            throw await de_OpsItemLimitExceededExceptionRes(parsedOutput, context);
        case "OpsItemNotFoundException":
        case "com.amazonaws.ssm#OpsItemNotFoundException":
            throw await de_OpsItemNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateOpsMetadataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateOpsMetadataCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateOpsMetadataCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "OpsMetadataInvalidArgumentException":
        case "com.amazonaws.ssm#OpsMetadataInvalidArgumentException":
            throw await de_OpsMetadataInvalidArgumentExceptionRes(parsedOutput, context);
        case "OpsMetadataKeyLimitExceededException":
        case "com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":
            throw await de_OpsMetadataKeyLimitExceededExceptionRes(parsedOutput, context);
        case "OpsMetadataNotFoundException":
        case "com.amazonaws.ssm#OpsMetadataNotFoundException":
            throw await de_OpsMetadataNotFoundExceptionRes(parsedOutput, context);
        case "OpsMetadataTooManyUpdatesException":
        case "com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":
            throw await de_OpsMetadataTooManyUpdatesExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdatePatchBaselineCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdatePatchBaselineCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UpdatePatchBaselineResult(data, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdatePatchBaselineCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "DoesNotExistException":
        case "com.amazonaws.ssm#DoesNotExistException":
            throw await de_DoesNotExistExceptionRes(parsedOutput, context);
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateResourceDataSyncCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateResourceDataSyncCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateResourceDataSyncCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ResourceDataSyncConflictException":
        case "com.amazonaws.ssm#ResourceDataSyncConflictException":
            throw await de_ResourceDataSyncConflictExceptionRes(parsedOutput, context);
        case "ResourceDataSyncInvalidConfigurationException":
        case "com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":
            throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(parsedOutput, context);
        case "ResourceDataSyncNotFoundException":
        case "com.amazonaws.ssm#ResourceDataSyncNotFoundException":
            throw await de_ResourceDataSyncNotFoundExceptionRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
export const de_UpdateServiceSettingCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_UpdateServiceSettingCommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = _json(data);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_UpdateServiceSettingCommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "InternalServerError":
        case "com.amazonaws.ssm#InternalServerError":
            throw await de_InternalServerErrorRes(parsedOutput, context);
        case "ServiceSettingNotFound":
        case "com.amazonaws.ssm#ServiceSettingNotFound":
            throw await de_ServiceSettingNotFoundRes(parsedOutput, context);
        case "TooManyUpdates":
        case "com.amazonaws.ssm#TooManyUpdates":
            throw await de_TooManyUpdatesRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody,
                errorCode,
            });
    }
};
const de_AlreadyExistsExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AlreadyExistsException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociatedInstancesRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociatedInstances({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociationAlreadyExistsRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociationAlreadyExists({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociationDoesNotExistRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociationDoesNotExist({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociationExecutionDoesNotExistRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociationExecutionDoesNotExist({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociationLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociationLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AssociationVersionLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AssociationVersionLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationDefinitionNotApprovedExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationDefinitionNotApprovedException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationDefinitionNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationDefinitionNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationDefinitionVersionNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationDefinitionVersionNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationExecutionLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationExecutionLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationExecutionNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationExecutionNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_AutomationStepNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new AutomationStepNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ComplianceTypeCountLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ComplianceTypeCountLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_CustomSchemaCountLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new CustomSchemaCountLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DocumentAlreadyExistsRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DocumentAlreadyExists({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DocumentLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DocumentLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DocumentPermissionLimitRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DocumentPermissionLimit({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DocumentVersionLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DocumentVersionLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DoesNotExistExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DoesNotExistException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DuplicateDocumentContentRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DuplicateDocumentContent({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DuplicateDocumentVersionNameRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DuplicateDocumentVersionName({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DuplicateInstanceIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new DuplicateInstanceId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_FeatureNotAvailableExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new FeatureNotAvailableException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_HierarchyLevelLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new HierarchyLevelLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_HierarchyTypeMismatchExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new HierarchyTypeMismatchException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_IdempotentParameterMismatchRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new IdempotentParameterMismatch({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_IncompatiblePolicyExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new IncompatiblePolicyException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InternalServerErrorRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InternalServerError({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidActivationRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidActivation({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidActivationIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidActivationId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAggregatorExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAggregatorException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAllowedPatternExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAllowedPatternException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAssociationRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAssociation({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAssociationVersionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAssociationVersion({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAutomationExecutionParametersExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAutomationExecutionParametersException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAutomationSignalExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAutomationSignalException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidAutomationStatusUpdateExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidAutomationStatusUpdateException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidCommandIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidCommandId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDeleteInventoryParametersExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDeleteInventoryParametersException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDeletionIdExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDeletionIdException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocument({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentContentRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocumentContent({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentOperationRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocumentOperation({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentSchemaVersionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocumentSchemaVersion({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentTypeRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocumentType({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidDocumentVersionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidDocumentVersion({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidFilterRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidFilter({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidFilterKeyRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidFilterKey({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidFilterOptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidFilterOption({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidFilterValueRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidFilterValue({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidInstanceIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidInstanceId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidInstanceInformationFilterValueRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidInstanceInformationFilterValue({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidInventoryGroupExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidInventoryGroupException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidInventoryItemContextExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidInventoryItemContextException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidInventoryRequestExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidInventoryRequestException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidItemContentExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidItemContentException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidKeyIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidKeyId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidNextTokenRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidNextToken({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidNotificationConfigRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidNotificationConfig({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidOptionExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidOptionException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidOutputFolderRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidOutputFolder({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidOutputLocationRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidOutputLocation({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidParametersRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidParameters({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidPermissionTypeRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidPermissionType({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidPluginNameRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidPluginName({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidPolicyAttributeExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidPolicyAttributeException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidPolicyTypeExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidPolicyTypeException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidResourceIdRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidResourceId({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidResourceTypeRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidResourceType({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidResultAttributeExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidResultAttributeException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidRoleRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidRole({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidScheduleRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidSchedule({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidTagRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidTag({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidTargetRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidTarget({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidTargetMapsRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidTargetMaps({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidTypeNameExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidTypeNameException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidUpdateRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvalidUpdate({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvocationDoesNotExistRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new InvocationDoesNotExist({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ItemContentMismatchExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ItemContentMismatchException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ItemSizeLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ItemSizeLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_MaxDocumentSizeExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new MaxDocumentSizeExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemAccessDeniedExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemAccessDeniedException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemAlreadyExistsExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemAlreadyExistsException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemConflictExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemConflictException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemInvalidParameterExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemInvalidParameterException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemRelatedItemAlreadyExistsExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemRelatedItemAlreadyExistsException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsItemRelatedItemAssociationNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsItemRelatedItemAssociationNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataAlreadyExistsExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataAlreadyExistsException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataInvalidArgumentExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataInvalidArgumentException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataKeyLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataKeyLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_OpsMetadataTooManyUpdatesExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new OpsMetadataTooManyUpdatesException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterAlreadyExistsRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterAlreadyExists({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterMaxVersionLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterMaxVersionLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterNotFoundRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterNotFound({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterPatternMismatchExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterPatternMismatchException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterVersionLabelLimitExceededRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterVersionLabelLimitExceeded({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ParameterVersionNotFoundRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ParameterVersionNotFound({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_PoliciesLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new PoliciesLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceDataSyncAlreadyExistsExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceDataSyncAlreadyExistsException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceDataSyncConflictExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceDataSyncConflictException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceDataSyncCountExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceDataSyncCountExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceDataSyncInvalidConfigurationExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceDataSyncInvalidConfigurationException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceDataSyncNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceDataSyncNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceInUseExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceInUseException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourceLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourcePolicyConflictExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourcePolicyConflictException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourcePolicyInvalidParameterExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourcePolicyInvalidParameterException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourcePolicyLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ResourcePolicyLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ServiceSettingNotFoundRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new ServiceSettingNotFound({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_StatusUnchangedRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new StatusUnchanged({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_SubTypeCountLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new SubTypeCountLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_TargetInUseExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new TargetInUseException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_TargetNotConnectedRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new TargetNotConnected({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_TooManyTagsErrorRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new TooManyTagsError({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_TooManyUpdatesRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new TooManyUpdates({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_TotalSizeLimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new TotalSizeLimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedCalendarExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedCalendarException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedFeatureRequiredExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedFeatureRequiredException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedInventoryItemContextExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedInventoryItemContextException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedInventorySchemaVersionExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedInventorySchemaVersionException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedOperatingSystemRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedOperatingSystem({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedParameterTypeRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedParameterType({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_UnsupportedPlatformTypeRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = _json(body);
    const exception = new UnsupportedPlatformType({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const se_AssociationStatus = (input, context) => {
    return take(input, {
        AdditionalInfo: [],
        Date: (_) => Math.round(_.getTime() / 1000),
        Message: [],
        Name: [],
    });
};
const se_ComplianceExecutionSummary = (input, context) => {
    return take(input, {
        ExecutionId: [],
        ExecutionTime: (_) => Math.round(_.getTime() / 1000),
        ExecutionType: [],
    });
};
const se_CreateActivationRequest = (input, context) => {
    return take(input, {
        DefaultInstanceName: [],
        Description: [],
        ExpirationDate: (_) => Math.round(_.getTime() / 1000),
        IamRole: [],
        RegistrationLimit: [],
        RegistrationMetadata: _json,
        Tags: _json,
    });
};
const se_CreateMaintenanceWindowRequest = (input, context) => {
    return take(input, {
        AllowUnassociatedTargets: [],
        ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
        Cutoff: [],
        Description: [],
        Duration: [],
        EndDate: [],
        Name: [],
        Schedule: [],
        ScheduleOffset: [],
        ScheduleTimezone: [],
        StartDate: [],
        Tags: _json,
    });
};
const se_CreateOpsItemRequest = (input, context) => {
    return take(input, {
        AccountId: [],
        ActualEndTime: (_) => Math.round(_.getTime() / 1000),
        ActualStartTime: (_) => Math.round(_.getTime() / 1000),
        Category: [],
        Description: [],
        Notifications: _json,
        OperationalData: _json,
        OpsItemType: [],
        PlannedEndTime: (_) => Math.round(_.getTime() / 1000),
        PlannedStartTime: (_) => Math.round(_.getTime() / 1000),
        Priority: [],
        RelatedOpsItems: _json,
        Severity: [],
        Source: [],
        Tags: _json,
        Title: [],
    });
};
const se_CreatePatchBaselineRequest = (input, context) => {
    return take(input, {
        ApprovalRules: _json,
        ApprovedPatches: _json,
        ApprovedPatchesComplianceLevel: [],
        ApprovedPatchesEnableNonSecurity: [],
        ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
        Description: [],
        GlobalFilters: _json,
        Name: [],
        OperatingSystem: [],
        RejectedPatches: _json,
        RejectedPatchesAction: [],
        Sources: _json,
        Tags: _json,
    });
};
const se_DeleteInventoryRequest = (input, context) => {
    return take(input, {
        ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
        DryRun: [],
        SchemaDeleteOption: [],
        TypeName: [],
    });
};
const se_GetInventoryRequest = (input, context) => {
    return take(input, {
        Aggregators: (_) => se_InventoryAggregatorList(_, context),
        Filters: _json,
        MaxResults: [],
        NextToken: [],
        ResultAttributes: _json,
    });
};
const se_GetOpsSummaryRequest = (input, context) => {
    return take(input, {
        Aggregators: (_) => se_OpsAggregatorList(_, context),
        Filters: _json,
        MaxResults: [],
        NextToken: [],
        ResultAttributes: _json,
        SyncName: [],
    });
};
const se_InventoryAggregator = (input, context) => {
    return take(input, {
        Aggregators: (_) => se_InventoryAggregatorList(_, context),
        Expression: [],
        Groups: _json,
    });
};
const se_InventoryAggregatorList = (input, context) => {
    return input
        .filter((e) => e != null)
        .map((entry) => {
        return se_InventoryAggregator(entry, context);
    });
};
const se_MaintenanceWindowLambdaParameters = (input, context) => {
    return take(input, {
        ClientContext: [],
        Payload: context.base64Encoder,
        Qualifier: [],
    });
};
const se_MaintenanceWindowTaskInvocationParameters = (input, context) => {
    return take(input, {
        Automation: _json,
        Lambda: (_) => se_MaintenanceWindowLambdaParameters(_, context),
        RunCommand: _json,
        StepFunctions: _json,
    });
};
const se_OpsAggregator = (input, context) => {
    return take(input, {
        AggregatorType: [],
        Aggregators: (_) => se_OpsAggregatorList(_, context),
        AttributeName: [],
        Filters: _json,
        TypeName: [],
        Values: _json,
    });
};
const se_OpsAggregatorList = (input, context) => {
    return input
        .filter((e) => e != null)
        .map((entry) => {
        return se_OpsAggregator(entry, context);
    });
};
const se_PutComplianceItemsRequest = (input, context) => {
    return take(input, {
        ComplianceType: [],
        ExecutionSummary: (_) => se_ComplianceExecutionSummary(_, context),
        ItemContentHash: [],
        Items: _json,
        ResourceId: [],
        ResourceType: [],
        UploadType: [],
    });
};
const se_RegisterTargetWithMaintenanceWindowRequest = (input, context) => {
    return take(input, {
        ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
        Description: [],
        Name: [],
        OwnerInformation: [],
        ResourceType: [],
        Targets: _json,
        WindowId: [],
    });
};
const se_RegisterTaskWithMaintenanceWindowRequest = (input, context) => {
    return take(input, {
        AlarmConfiguration: _json,
        ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
        CutoffBehavior: [],
        Description: [],
        LoggingInfo: _json,
        MaxConcurrency: [],
        MaxErrors: [],
        Name: [],
        Priority: [],
        ServiceRoleArn: [],
        Targets: _json,
        TaskArn: [],
        TaskInvocationParameters: (_) => se_MaintenanceWindowTaskInvocationParameters(_, context),
        TaskParameters: _json,
        TaskType: [],
        WindowId: [],
    });
};
const se_StartChangeRequestExecutionRequest = (input, context) => {
    return take(input, {
        AutoApprove: [],
        ChangeDetails: [],
        ChangeRequestName: [],
        ClientToken: [],
        DocumentName: [],
        DocumentVersion: [],
        Parameters: _json,
        Runbooks: _json,
        ScheduledEndTime: (_) => Math.round(_.getTime() / 1000),
        ScheduledTime: (_) => Math.round(_.getTime() / 1000),
        Tags: _json,
    });
};
const se_UpdateAssociationStatusRequest = (input, context) => {
    return take(input, {
        AssociationStatus: (_) => se_AssociationStatus(_, context),
        InstanceId: [],
        Name: [],
    });
};
const se_UpdateMaintenanceWindowTaskRequest = (input, context) => {
    return take(input, {
        AlarmConfiguration: _json,
        CutoffBehavior: [],
        Description: [],
        LoggingInfo: _json,
        MaxConcurrency: [],
        MaxErrors: [],
        Name: [],
        Priority: [],
        Replace: [],
        ServiceRoleArn: [],
        Targets: _json,
        TaskArn: [],
        TaskInvocationParameters: (_) => se_MaintenanceWindowTaskInvocationParameters(_, context),
        TaskParameters: _json,
        WindowId: [],
        WindowTaskId: [],
    });
};
const se_UpdateOpsItemRequest = (input, context) => {
    return take(input, {
        ActualEndTime: (_) => Math.round(_.getTime() / 1000),
        ActualStartTime: (_) => Math.round(_.getTime() / 1000),
        Category: [],
        Description: [],
        Notifications: _json,
        OperationalData: _json,
        OperationalDataToDelete: _json,
        OpsItemArn: [],
        OpsItemId: [],
        PlannedEndTime: (_) => Math.round(_.getTime() / 1000),
        PlannedStartTime: (_) => Math.round(_.getTime() / 1000),
        Priority: [],
        RelatedOpsItems: _json,
        Severity: [],
        Status: [],
        Title: [],
    });
};
const de_Activation = (output, context) => {
    return take(output, {
        ActivationId: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DefaultInstanceName: __expectString,
        Description: __expectString,
        ExpirationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Expired: __expectBoolean,
        IamRole: __expectString,
        RegistrationLimit: __expectInt32,
        RegistrationsCount: __expectInt32,
        Tags: _json,
    });
};
const de_ActivationList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Activation(entry, context);
    });
    return retVal;
};
const de_Association = (output, context) => {
    return take(output, {
        AssociationId: __expectString,
        AssociationName: __expectString,
        AssociationVersion: __expectString,
        DocumentVersion: __expectString,
        InstanceId: __expectString,
        LastExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        Overview: _json,
        ScheduleExpression: __expectString,
        ScheduleOffset: __expectInt32,
        TargetMaps: _json,
        Targets: _json,
    });
};
const de_AssociationDescription = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        ApplyOnlyAtCronInterval: __expectBoolean,
        AssociationId: __expectString,
        AssociationName: __expectString,
        AssociationVersion: __expectString,
        AutomationTargetParameterName: __expectString,
        CalendarNames: _json,
        ComplianceSeverity: __expectString,
        Date: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DocumentVersion: __expectString,
        InstanceId: __expectString,
        LastExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastSuccessfulExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastUpdateAssociationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Name: __expectString,
        OutputLocation: _json,
        Overview: _json,
        Parameters: _json,
        ScheduleExpression: __expectString,
        ScheduleOffset: __expectInt32,
        Status: (_) => de_AssociationStatus(_, context),
        SyncCompliance: __expectString,
        TargetLocations: _json,
        TargetMaps: _json,
        Targets: _json,
        TriggeredAlarms: _json,
    });
};
const de_AssociationDescriptionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AssociationDescription(entry, context);
    });
    return retVal;
};
const de_AssociationExecution = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        AssociationId: __expectString,
        AssociationVersion: __expectString,
        CreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DetailedStatus: __expectString,
        ExecutionId: __expectString,
        LastExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ResourceCountByStatus: __expectString,
        Status: __expectString,
        TriggeredAlarms: _json,
    });
};
const de_AssociationExecutionsList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AssociationExecution(entry, context);
    });
    return retVal;
};
const de_AssociationExecutionTarget = (output, context) => {
    return take(output, {
        AssociationId: __expectString,
        AssociationVersion: __expectString,
        DetailedStatus: __expectString,
        ExecutionId: __expectString,
        LastExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        OutputSource: _json,
        ResourceId: __expectString,
        ResourceType: __expectString,
        Status: __expectString,
    });
};
const de_AssociationExecutionTargetsList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AssociationExecutionTarget(entry, context);
    });
    return retVal;
};
const de_AssociationList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Association(entry, context);
    });
    return retVal;
};
const de_AssociationStatus = (output, context) => {
    return take(output, {
        AdditionalInfo: __expectString,
        Date: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Message: __expectString,
        Name: __expectString,
    });
};
const de_AssociationVersionInfo = (output, context) => {
    return take(output, {
        ApplyOnlyAtCronInterval: __expectBoolean,
        AssociationId: __expectString,
        AssociationName: __expectString,
        AssociationVersion: __expectString,
        CalendarNames: _json,
        ComplianceSeverity: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DocumentVersion: __expectString,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Name: __expectString,
        OutputLocation: _json,
        Parameters: _json,
        ScheduleExpression: __expectString,
        ScheduleOffset: __expectInt32,
        SyncCompliance: __expectString,
        TargetLocations: _json,
        TargetMaps: _json,
        Targets: _json,
    });
};
const de_AssociationVersionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AssociationVersionInfo(entry, context);
    });
    return retVal;
};
const de_AutomationExecution = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        AssociationId: __expectString,
        AutomationExecutionId: __expectString,
        AutomationExecutionStatus: __expectString,
        AutomationSubtype: __expectString,
        ChangeRequestName: __expectString,
        CurrentAction: __expectString,
        CurrentStepName: __expectString,
        DocumentName: __expectString,
        DocumentVersion: __expectString,
        ExecutedBy: __expectString,
        ExecutionEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        FailureMessage: __expectString,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Mode: __expectString,
        OpsItemId: __expectString,
        Outputs: _json,
        Parameters: _json,
        ParentAutomationExecutionId: __expectString,
        ProgressCounters: _json,
        ResolvedTargets: _json,
        Runbooks: _json,
        ScheduledTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        StepExecutions: (_) => de_StepExecutionList(_, context),
        StepExecutionsTruncated: __expectBoolean,
        Target: __expectString,
        TargetLocations: _json,
        TargetMaps: _json,
        TargetParameterName: __expectString,
        Targets: _json,
        TriggeredAlarms: _json,
        Variables: _json,
    });
};
const de_AutomationExecutionMetadata = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        AssociationId: __expectString,
        AutomationExecutionId: __expectString,
        AutomationExecutionStatus: __expectString,
        AutomationSubtype: __expectString,
        AutomationType: __expectString,
        ChangeRequestName: __expectString,
        CurrentAction: __expectString,
        CurrentStepName: __expectString,
        DocumentName: __expectString,
        DocumentVersion: __expectString,
        ExecutedBy: __expectString,
        ExecutionEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        FailureMessage: __expectString,
        LogFile: __expectString,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Mode: __expectString,
        OpsItemId: __expectString,
        Outputs: _json,
        ParentAutomationExecutionId: __expectString,
        ResolvedTargets: _json,
        Runbooks: _json,
        ScheduledTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Target: __expectString,
        TargetMaps: _json,
        TargetParameterName: __expectString,
        Targets: _json,
        TriggeredAlarms: _json,
    });
};
const de_AutomationExecutionMetadataList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AutomationExecutionMetadata(entry, context);
    });
    return retVal;
};
const de_Command = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        CloudWatchOutputConfig: _json,
        CommandId: __expectString,
        Comment: __expectString,
        CompletedCount: __expectInt32,
        DeliveryTimedOutCount: __expectInt32,
        DocumentName: __expectString,
        DocumentVersion: __expectString,
        ErrorCount: __expectInt32,
        ExpiresAfter: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        InstanceIds: _json,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        NotificationConfig: _json,
        OutputS3BucketName: __expectString,
        OutputS3KeyPrefix: __expectString,
        OutputS3Region: __expectString,
        Parameters: _json,
        RequestedDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ServiceRole: __expectString,
        Status: __expectString,
        StatusDetails: __expectString,
        TargetCount: __expectInt32,
        Targets: _json,
        TimeoutSeconds: __expectInt32,
        TriggeredAlarms: _json,
    });
};
const de_CommandInvocation = (output, context) => {
    return take(output, {
        CloudWatchOutputConfig: _json,
        CommandId: __expectString,
        CommandPlugins: (_) => de_CommandPluginList(_, context),
        Comment: __expectString,
        DocumentName: __expectString,
        DocumentVersion: __expectString,
        InstanceId: __expectString,
        InstanceName: __expectString,
        NotificationConfig: _json,
        RequestedDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ServiceRole: __expectString,
        StandardErrorUrl: __expectString,
        StandardOutputUrl: __expectString,
        Status: __expectString,
        StatusDetails: __expectString,
        TraceOutput: __expectString,
    });
};
const de_CommandInvocationList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_CommandInvocation(entry, context);
    });
    return retVal;
};
const de_CommandList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Command(entry, context);
    });
    return retVal;
};
const de_CommandPlugin = (output, context) => {
    return take(output, {
        Name: __expectString,
        Output: __expectString,
        OutputS3BucketName: __expectString,
        OutputS3KeyPrefix: __expectString,
        OutputS3Region: __expectString,
        ResponseCode: __expectInt32,
        ResponseFinishDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ResponseStartDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        StandardErrorUrl: __expectString,
        StandardOutputUrl: __expectString,
        Status: __expectString,
        StatusDetails: __expectString,
    });
};
const de_CommandPluginList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_CommandPlugin(entry, context);
    });
    return retVal;
};
const de_ComplianceExecutionSummary = (output, context) => {
    return take(output, {
        ExecutionId: __expectString,
        ExecutionTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionType: __expectString,
    });
};
const de_ComplianceItem = (output, context) => {
    return take(output, {
        ComplianceType: __expectString,
        Details: _json,
        ExecutionSummary: (_) => de_ComplianceExecutionSummary(_, context),
        Id: __expectString,
        ResourceId: __expectString,
        ResourceType: __expectString,
        Severity: __expectString,
        Status: __expectString,
        Title: __expectString,
    });
};
const de_ComplianceItemList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ComplianceItem(entry, context);
    });
    return retVal;
};
const de_CreateAssociationBatchResult = (output, context) => {
    return take(output, {
        Failed: _json,
        Successful: (_) => de_AssociationDescriptionList(_, context),
    });
};
const de_CreateAssociationResult = (output, context) => {
    return take(output, {
        AssociationDescription: (_) => de_AssociationDescription(_, context),
    });
};
const de_CreateDocumentResult = (output, context) => {
    return take(output, {
        DocumentDescription: (_) => de_DocumentDescription(_, context),
    });
};
const de_DescribeActivationsResult = (output, context) => {
    return take(output, {
        ActivationList: (_) => de_ActivationList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeAssociationExecutionsResult = (output, context) => {
    return take(output, {
        AssociationExecutions: (_) => de_AssociationExecutionsList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeAssociationExecutionTargetsResult = (output, context) => {
    return take(output, {
        AssociationExecutionTargets: (_) => de_AssociationExecutionTargetsList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeAssociationResult = (output, context) => {
    return take(output, {
        AssociationDescription: (_) => de_AssociationDescription(_, context),
    });
};
const de_DescribeAutomationExecutionsResult = (output, context) => {
    return take(output, {
        AutomationExecutionMetadataList: (_) => de_AutomationExecutionMetadataList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeAutomationStepExecutionsResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        StepExecutions: (_) => de_StepExecutionList(_, context),
    });
};
const de_DescribeAvailablePatchesResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Patches: (_) => de_PatchList(_, context),
    });
};
const de_DescribeDocumentResult = (output, context) => {
    return take(output, {
        Document: (_) => de_DocumentDescription(_, context),
    });
};
const de_DescribeEffectivePatchesForPatchBaselineResult = (output, context) => {
    return take(output, {
        EffectivePatches: (_) => de_EffectivePatchList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeInstanceAssociationsStatusResult = (output, context) => {
    return take(output, {
        InstanceAssociationStatusInfos: (_) => de_InstanceAssociationStatusInfos(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeInstanceInformationResult = (output, context) => {
    return take(output, {
        InstanceInformationList: (_) => de_InstanceInformationList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeInstancePatchesResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Patches: (_) => de_PatchComplianceDataList(_, context),
    });
};
const de_DescribeInstancePatchStatesForPatchGroupResult = (output, context) => {
    return take(output, {
        InstancePatchStates: (_) => de_InstancePatchStatesList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeInstancePatchStatesResult = (output, context) => {
    return take(output, {
        InstancePatchStates: (_) => de_InstancePatchStateList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeInventoryDeletionsResult = (output, context) => {
    return take(output, {
        InventoryDeletions: (_) => de_InventoryDeletionsList(_, context),
        NextToken: __expectString,
    });
};
const de_DescribeMaintenanceWindowExecutionsResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        WindowExecutions: (_) => de_MaintenanceWindowExecutionList(_, context),
    });
};
const de_DescribeMaintenanceWindowExecutionTaskInvocationsResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        WindowExecutionTaskInvocationIdentities: (_) => de_MaintenanceWindowExecutionTaskInvocationIdentityList(_, context),
    });
};
const de_DescribeMaintenanceWindowExecutionTasksResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        WindowExecutionTaskIdentities: (_) => de_MaintenanceWindowExecutionTaskIdentityList(_, context),
    });
};
const de_DescribeOpsItemsResponse = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        OpsItemSummaries: (_) => de_OpsItemSummaries(_, context),
    });
};
const de_DescribeParametersResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Parameters: (_) => de_ParameterMetadataList(_, context),
    });
};
const de_DescribeSessionsResponse = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Sessions: (_) => de_SessionList(_, context),
    });
};
const de_DocumentDescription = (output, context) => {
    return take(output, {
        ApprovedVersion: __expectString,
        AttachmentsInformation: _json,
        Author: __expectString,
        Category: _json,
        CategoryEnum: _json,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DefaultVersion: __expectString,
        Description: __expectString,
        DisplayName: __expectString,
        DocumentFormat: __expectString,
        DocumentType: __expectString,
        DocumentVersion: __expectString,
        Hash: __expectString,
        HashType: __expectString,
        LatestVersion: __expectString,
        Name: __expectString,
        Owner: __expectString,
        Parameters: _json,
        PendingReviewVersion: __expectString,
        PlatformTypes: _json,
        Requires: _json,
        ReviewInformation: (_) => de_ReviewInformationList(_, context),
        ReviewStatus: __expectString,
        SchemaVersion: __expectString,
        Sha1: __expectString,
        Status: __expectString,
        StatusInformation: __expectString,
        Tags: _json,
        TargetType: __expectString,
        VersionName: __expectString,
    });
};
const de_DocumentIdentifier = (output, context) => {
    return take(output, {
        Author: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DisplayName: __expectString,
        DocumentFormat: __expectString,
        DocumentType: __expectString,
        DocumentVersion: __expectString,
        Name: __expectString,
        Owner: __expectString,
        PlatformTypes: _json,
        Requires: _json,
        ReviewStatus: __expectString,
        SchemaVersion: __expectString,
        Tags: _json,
        TargetType: __expectString,
        VersionName: __expectString,
    });
};
const de_DocumentIdentifierList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_DocumentIdentifier(entry, context);
    });
    return retVal;
};
const de_DocumentMetadataResponseInfo = (output, context) => {
    return take(output, {
        ReviewerResponse: (_) => de_DocumentReviewerResponseList(_, context),
    });
};
const de_DocumentReviewerResponseList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_DocumentReviewerResponseSource(entry, context);
    });
    return retVal;
};
const de_DocumentReviewerResponseSource = (output, context) => {
    return take(output, {
        Comment: _json,
        CreateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ReviewStatus: __expectString,
        Reviewer: __expectString,
        UpdatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
    });
};
const de_DocumentVersionInfo = (output, context) => {
    return take(output, {
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DisplayName: __expectString,
        DocumentFormat: __expectString,
        DocumentVersion: __expectString,
        IsDefaultVersion: __expectBoolean,
        Name: __expectString,
        ReviewStatus: __expectString,
        Status: __expectString,
        StatusInformation: __expectString,
        VersionName: __expectString,
    });
};
const de_DocumentVersionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_DocumentVersionInfo(entry, context);
    });
    return retVal;
};
const de_EffectivePatch = (output, context) => {
    return take(output, {
        Patch: (_) => de_Patch(_, context),
        PatchStatus: (_) => de_PatchStatus(_, context),
    });
};
const de_EffectivePatchList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_EffectivePatch(entry, context);
    });
    return retVal;
};
const de_GetAutomationExecutionResult = (output, context) => {
    return take(output, {
        AutomationExecution: (_) => de_AutomationExecution(_, context),
    });
};
const de_GetDocumentResult = (output, context) => {
    return take(output, {
        AttachmentsContent: _json,
        Content: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DisplayName: __expectString,
        DocumentFormat: __expectString,
        DocumentType: __expectString,
        DocumentVersion: __expectString,
        Name: __expectString,
        Requires: _json,
        ReviewStatus: __expectString,
        Status: __expectString,
        StatusInformation: __expectString,
        VersionName: __expectString,
    });
};
const de_GetMaintenanceWindowExecutionResult = (output, context) => {
    return take(output, {
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        TaskIds: _json,
        WindowExecutionId: __expectString,
    });
};
const de_GetMaintenanceWindowExecutionTaskInvocationResult = (output, context) => {
    return take(output, {
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionId: __expectString,
        InvocationId: __expectString,
        OwnerInformation: __expectString,
        Parameters: __expectString,
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        TaskExecutionId: __expectString,
        TaskType: __expectString,
        WindowExecutionId: __expectString,
        WindowTargetId: __expectString,
    });
};
const de_GetMaintenanceWindowExecutionTaskResult = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Priority: __expectInt32,
        ServiceRole: __expectString,
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        TaskArn: __expectString,
        TaskExecutionId: __expectString,
        TaskParameters: _json,
        TriggeredAlarms: _json,
        Type: __expectString,
        WindowExecutionId: __expectString,
    });
};
const de_GetMaintenanceWindowResult = (output, context) => {
    return take(output, {
        AllowUnassociatedTargets: __expectBoolean,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Cutoff: __expectInt32,
        Description: __expectString,
        Duration: __expectInt32,
        Enabled: __expectBoolean,
        EndDate: __expectString,
        ModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        NextExecutionTime: __expectString,
        Schedule: __expectString,
        ScheduleOffset: __expectInt32,
        ScheduleTimezone: __expectString,
        StartDate: __expectString,
        WindowId: __expectString,
    });
};
const de_GetMaintenanceWindowTaskResult = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        CutoffBehavior: __expectString,
        Description: __expectString,
        LoggingInfo: _json,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Name: __expectString,
        Priority: __expectInt32,
        ServiceRoleArn: __expectString,
        Targets: _json,
        TaskArn: __expectString,
        TaskInvocationParameters: (_) => de_MaintenanceWindowTaskInvocationParameters(_, context),
        TaskParameters: _json,
        TaskType: __expectString,
        WindowId: __expectString,
        WindowTaskId: __expectString,
    });
};
const de_GetOpsItemResponse = (output, context) => {
    return take(output, {
        OpsItem: (_) => de_OpsItem(_, context),
    });
};
const de_GetParameterHistoryResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Parameters: (_) => de_ParameterHistoryList(_, context),
    });
};
const de_GetParameterResult = (output, context) => {
    return take(output, {
        Parameter: (_) => de_Parameter(_, context),
    });
};
const de_GetParametersByPathResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Parameters: (_) => de_ParameterList(_, context),
    });
};
const de_GetParametersResult = (output, context) => {
    return take(output, {
        InvalidParameters: _json,
        Parameters: (_) => de_ParameterList(_, context),
    });
};
const de_GetPatchBaselineResult = (output, context) => {
    return take(output, {
        ApprovalRules: _json,
        ApprovedPatches: _json,
        ApprovedPatchesComplianceLevel: __expectString,
        ApprovedPatchesEnableNonSecurity: __expectBoolean,
        BaselineId: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Description: __expectString,
        GlobalFilters: _json,
        ModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        OperatingSystem: __expectString,
        PatchGroups: _json,
        RejectedPatches: _json,
        RejectedPatchesAction: __expectString,
        Sources: _json,
    });
};
const de_GetServiceSettingResult = (output, context) => {
    return take(output, {
        ServiceSetting: (_) => de_ServiceSetting(_, context),
    });
};
const de_InstanceAssociationStatusInfo = (output, context) => {
    return take(output, {
        AssociationId: __expectString,
        AssociationName: __expectString,
        AssociationVersion: __expectString,
        DetailedStatus: __expectString,
        DocumentVersion: __expectString,
        ErrorCode: __expectString,
        ExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionSummary: __expectString,
        InstanceId: __expectString,
        Name: __expectString,
        OutputUrl: _json,
        Status: __expectString,
    });
};
const de_InstanceAssociationStatusInfos = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InstanceAssociationStatusInfo(entry, context);
    });
    return retVal;
};
const de_InstanceInformation = (output, context) => {
    return take(output, {
        ActivationId: __expectString,
        AgentVersion: __expectString,
        AssociationOverview: _json,
        AssociationStatus: __expectString,
        ComputerName: __expectString,
        IPAddress: __expectString,
        IamRole: __expectString,
        InstanceId: __expectString,
        IsLatestVersion: __expectBoolean,
        LastAssociationExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastPingDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastSuccessfulAssociationExecutionDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        PingStatus: __expectString,
        PlatformName: __expectString,
        PlatformType: __expectString,
        PlatformVersion: __expectString,
        RegistrationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ResourceType: __expectString,
        SourceId: __expectString,
        SourceType: __expectString,
    });
};
const de_InstanceInformationList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InstanceInformation(entry, context);
    });
    return retVal;
};
const de_InstancePatchState = (output, context) => {
    return take(output, {
        BaselineId: __expectString,
        CriticalNonCompliantCount: __expectInt32,
        FailedCount: __expectInt32,
        InstallOverrideList: __expectString,
        InstalledCount: __expectInt32,
        InstalledOtherCount: __expectInt32,
        InstalledPendingRebootCount: __expectInt32,
        InstalledRejectedCount: __expectInt32,
        InstanceId: __expectString,
        LastNoRebootInstallOperationTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        MissingCount: __expectInt32,
        NotApplicableCount: __expectInt32,
        Operation: __expectString,
        OperationEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        OperationStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        OtherNonCompliantCount: __expectInt32,
        OwnerInformation: __expectString,
        PatchGroup: __expectString,
        RebootOption: __expectString,
        SecurityNonCompliantCount: __expectInt32,
        SnapshotId: __expectString,
        UnreportedNotApplicableCount: __expectInt32,
    });
};
const de_InstancePatchStateList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InstancePatchState(entry, context);
    });
    return retVal;
};
const de_InstancePatchStatesList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InstancePatchState(entry, context);
    });
    return retVal;
};
const de_InventoryDeletionsList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InventoryDeletionStatusItem(entry, context);
    });
    return retVal;
};
const de_InventoryDeletionStatusItem = (output, context) => {
    return take(output, {
        DeletionId: __expectString,
        DeletionStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        DeletionSummary: _json,
        LastStatus: __expectString,
        LastStatusMessage: __expectString,
        LastStatusUpdateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        TypeName: __expectString,
    });
};
const de_ListAssociationsResult = (output, context) => {
    return take(output, {
        Associations: (_) => de_AssociationList(_, context),
        NextToken: __expectString,
    });
};
const de_ListAssociationVersionsResult = (output, context) => {
    return take(output, {
        AssociationVersions: (_) => de_AssociationVersionList(_, context),
        NextToken: __expectString,
    });
};
const de_ListCommandInvocationsResult = (output, context) => {
    return take(output, {
        CommandInvocations: (_) => de_CommandInvocationList(_, context),
        NextToken: __expectString,
    });
};
const de_ListCommandsResult = (output, context) => {
    return take(output, {
        Commands: (_) => de_CommandList(_, context),
        NextToken: __expectString,
    });
};
const de_ListComplianceItemsResult = (output, context) => {
    return take(output, {
        ComplianceItems: (_) => de_ComplianceItemList(_, context),
        NextToken: __expectString,
    });
};
const de_ListDocumentMetadataHistoryResponse = (output, context) => {
    return take(output, {
        Author: __expectString,
        DocumentVersion: __expectString,
        Metadata: (_) => de_DocumentMetadataResponseInfo(_, context),
        Name: __expectString,
        NextToken: __expectString,
    });
};
const de_ListDocumentsResult = (output, context) => {
    return take(output, {
        DocumentIdentifiers: (_) => de_DocumentIdentifierList(_, context),
        NextToken: __expectString,
    });
};
const de_ListDocumentVersionsResult = (output, context) => {
    return take(output, {
        DocumentVersions: (_) => de_DocumentVersionList(_, context),
        NextToken: __expectString,
    });
};
const de_ListOpsItemEventsResponse = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Summaries: (_) => de_OpsItemEventSummaries(_, context),
    });
};
const de_ListOpsItemRelatedItemsResponse = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        Summaries: (_) => de_OpsItemRelatedItemSummaries(_, context),
    });
};
const de_ListOpsMetadataResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        OpsMetadataList: (_) => de_OpsMetadataList(_, context),
    });
};
const de_ListResourceComplianceSummariesResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        ResourceComplianceSummaryItems: (_) => de_ResourceComplianceSummaryItemList(_, context),
    });
};
const de_ListResourceDataSyncResult = (output, context) => {
    return take(output, {
        NextToken: __expectString,
        ResourceDataSyncItems: (_) => de_ResourceDataSyncItemList(_, context),
    });
};
const de_MaintenanceWindowExecution = (output, context) => {
    return take(output, {
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        WindowExecutionId: __expectString,
        WindowId: __expectString,
    });
};
const de_MaintenanceWindowExecutionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MaintenanceWindowExecution(entry, context);
    });
    return retVal;
};
const de_MaintenanceWindowExecutionTaskIdentity = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        TaskArn: __expectString,
        TaskExecutionId: __expectString,
        TaskType: __expectString,
        TriggeredAlarms: _json,
        WindowExecutionId: __expectString,
    });
};
const de_MaintenanceWindowExecutionTaskIdentityList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MaintenanceWindowExecutionTaskIdentity(entry, context);
    });
    return retVal;
};
const de_MaintenanceWindowExecutionTaskInvocationIdentity = (output, context) => {
    return take(output, {
        EndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionId: __expectString,
        InvocationId: __expectString,
        OwnerInformation: __expectString,
        Parameters: __expectString,
        StartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        StatusDetails: __expectString,
        TaskExecutionId: __expectString,
        TaskType: __expectString,
        WindowExecutionId: __expectString,
        WindowTargetId: __expectString,
    });
};
const de_MaintenanceWindowExecutionTaskInvocationIdentityList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MaintenanceWindowExecutionTaskInvocationIdentity(entry, context);
    });
    return retVal;
};
const de_MaintenanceWindowLambdaParameters = (output, context) => {
    return take(output, {
        ClientContext: __expectString,
        Payload: context.base64Decoder,
        Qualifier: __expectString,
    });
};
const de_MaintenanceWindowTaskInvocationParameters = (output, context) => {
    return take(output, {
        Automation: _json,
        Lambda: (_) => de_MaintenanceWindowLambdaParameters(_, context),
        RunCommand: _json,
        StepFunctions: _json,
    });
};
const de_OpsItem = (output, context) => {
    return take(output, {
        ActualEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ActualStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Category: __expectString,
        CreatedBy: __expectString,
        CreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Description: __expectString,
        LastModifiedBy: __expectString,
        LastModifiedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Notifications: _json,
        OperationalData: _json,
        OpsItemArn: __expectString,
        OpsItemId: __expectString,
        OpsItemType: __expectString,
        PlannedEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        PlannedStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Priority: __expectInt32,
        RelatedOpsItems: _json,
        Severity: __expectString,
        Source: __expectString,
        Status: __expectString,
        Title: __expectString,
        Version: __expectString,
    });
};
const de_OpsItemEventSummaries = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_OpsItemEventSummary(entry, context);
    });
    return retVal;
};
const de_OpsItemEventSummary = (output, context) => {
    return take(output, {
        CreatedBy: _json,
        CreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Detail: __expectString,
        DetailType: __expectString,
        EventId: __expectString,
        OpsItemId: __expectString,
        Source: __expectString,
    });
};
const de_OpsItemRelatedItemSummaries = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_OpsItemRelatedItemSummary(entry, context);
    });
    return retVal;
};
const de_OpsItemRelatedItemSummary = (output, context) => {
    return take(output, {
        AssociationId: __expectString,
        AssociationType: __expectString,
        CreatedBy: _json,
        CreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedBy: _json,
        LastModifiedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        OpsItemId: __expectString,
        ResourceType: __expectString,
        ResourceUri: __expectString,
    });
};
const de_OpsItemSummaries = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_OpsItemSummary(entry, context);
    });
    return retVal;
};
const de_OpsItemSummary = (output, context) => {
    return take(output, {
        ActualEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ActualStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Category: __expectString,
        CreatedBy: __expectString,
        CreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedBy: __expectString,
        LastModifiedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        OperationalData: _json,
        OpsItemId: __expectString,
        OpsItemType: __expectString,
        PlannedEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        PlannedStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Priority: __expectInt32,
        Severity: __expectString,
        Source: __expectString,
        Status: __expectString,
        Title: __expectString,
    });
};
const de_OpsMetadata = (output, context) => {
    return take(output, {
        CreationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedUser: __expectString,
        OpsMetadataArn: __expectString,
        ResourceId: __expectString,
    });
};
const de_OpsMetadataList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_OpsMetadata(entry, context);
    });
    return retVal;
};
const de_Parameter = (output, context) => {
    return take(output, {
        ARN: __expectString,
        DataType: __expectString,
        LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        Selector: __expectString,
        SourceResult: __expectString,
        Type: __expectString,
        Value: __expectString,
        Version: __expectLong,
    });
};
const de_ParameterHistory = (output, context) => {
    return take(output, {
        AllowedPattern: __expectString,
        DataType: __expectString,
        Description: __expectString,
        KeyId: __expectString,
        Labels: _json,
        LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedUser: __expectString,
        Name: __expectString,
        Policies: _json,
        Tier: __expectString,
        Type: __expectString,
        Value: __expectString,
        Version: __expectLong,
    });
};
const de_ParameterHistoryList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ParameterHistory(entry, context);
    });
    return retVal;
};
const de_ParameterList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Parameter(entry, context);
    });
    return retVal;
};
const de_ParameterMetadata = (output, context) => {
    return take(output, {
        AllowedPattern: __expectString,
        DataType: __expectString,
        Description: __expectString,
        KeyId: __expectString,
        LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedUser: __expectString,
        Name: __expectString,
        Policies: _json,
        Tier: __expectString,
        Type: __expectString,
        Version: __expectLong,
    });
};
const de_ParameterMetadataList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ParameterMetadata(entry, context);
    });
    return retVal;
};
const de_Patch = (output, context) => {
    return take(output, {
        AdvisoryIds: _json,
        Arch: __expectString,
        BugzillaIds: _json,
        CVEIds: _json,
        Classification: __expectString,
        ContentUrl: __expectString,
        Description: __expectString,
        Epoch: __expectInt32,
        Id: __expectString,
        KbNumber: __expectString,
        Language: __expectString,
        MsrcNumber: __expectString,
        MsrcSeverity: __expectString,
        Name: __expectString,
        Product: __expectString,
        ProductFamily: __expectString,
        Release: __expectString,
        ReleaseDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Repository: __expectString,
        Severity: __expectString,
        Title: __expectString,
        Vendor: __expectString,
        Version: __expectString,
    });
};
const de_PatchComplianceData = (output, context) => {
    return take(output, {
        CVEIds: __expectString,
        Classification: __expectString,
        InstalledTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        KBId: __expectString,
        Severity: __expectString,
        State: __expectString,
        Title: __expectString,
    });
};
const de_PatchComplianceDataList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_PatchComplianceData(entry, context);
    });
    return retVal;
};
const de_PatchList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Patch(entry, context);
    });
    return retVal;
};
const de_PatchStatus = (output, context) => {
    return take(output, {
        ApprovalDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ComplianceLevel: __expectString,
        DeploymentStatus: __expectString,
    });
};
const de_ResetServiceSettingResult = (output, context) => {
    return take(output, {
        ServiceSetting: (_) => de_ServiceSetting(_, context),
    });
};
const de_ResourceComplianceSummaryItem = (output, context) => {
    return take(output, {
        ComplianceType: __expectString,
        CompliantSummary: _json,
        ExecutionSummary: (_) => de_ComplianceExecutionSummary(_, context),
        NonCompliantSummary: _json,
        OverallSeverity: __expectString,
        ResourceId: __expectString,
        ResourceType: __expectString,
        Status: __expectString,
    });
};
const de_ResourceComplianceSummaryItemList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ResourceComplianceSummaryItem(entry, context);
    });
    return retVal;
};
const de_ResourceDataSyncItem = (output, context) => {
    return take(output, {
        LastStatus: __expectString,
        LastSuccessfulSyncTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastSyncStatusMessage: __expectString,
        LastSyncTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        S3Destination: _json,
        SyncCreatedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        SyncLastModifiedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        SyncName: __expectString,
        SyncSource: _json,
        SyncType: __expectString,
    });
};
const de_ResourceDataSyncItemList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ResourceDataSyncItem(entry, context);
    });
    return retVal;
};
const de_ReviewInformation = (output, context) => {
    return take(output, {
        ReviewedTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Reviewer: __expectString,
        Status: __expectString,
    });
};
const de_ReviewInformationList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ReviewInformation(entry, context);
    });
    return retVal;
};
const de_SendCommandResult = (output, context) => {
    return take(output, {
        Command: (_) => de_Command(_, context),
    });
};
const de_ServiceSetting = (output, context) => {
    return take(output, {
        ARN: __expectString,
        LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        LastModifiedUser: __expectString,
        SettingId: __expectString,
        SettingValue: __expectString,
        Status: __expectString,
    });
};
const de_Session = (output, context) => {
    return take(output, {
        Details: __expectString,
        DocumentName: __expectString,
        EndDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        MaxSessionDuration: __expectString,
        OutputUrl: _json,
        Owner: __expectString,
        Reason: __expectString,
        SessionId: __expectString,
        StartDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Status: __expectString,
        Target: __expectString,
    });
};
const de_SessionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Session(entry, context);
    });
    return retVal;
};
const de_StepExecution = (output, context) => {
    return take(output, {
        Action: __expectString,
        ExecutionEndTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        ExecutionStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        FailureDetails: _json,
        FailureMessage: __expectString,
        Inputs: _json,
        IsCritical: __expectBoolean,
        IsEnd: __expectBoolean,
        MaxAttempts: __expectInt32,
        NextStep: __expectString,
        OnFailure: __expectString,
        Outputs: _json,
        OverriddenParameters: _json,
        ParentStepDetails: _json,
        Response: __expectString,
        ResponseCode: __expectString,
        StepExecutionId: __expectString,
        StepName: __expectString,
        StepStatus: __expectString,
        TargetLocation: _json,
        Targets: _json,
        TimeoutSeconds: __expectLong,
        TriggeredAlarms: _json,
        ValidNextSteps: _json,
    });
};
const de_StepExecutionList = (output, context) => {
    const retVal = (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_StepExecution(entry, context);
    });
    return retVal;
};
const de_UpdateAssociationResult = (output, context) => {
    return take(output, {
        AssociationDescription: (_) => de_AssociationDescription(_, context),
    });
};
const de_UpdateAssociationStatusResult = (output, context) => {
    return take(output, {
        AssociationDescription: (_) => de_AssociationDescription(_, context),
    });
};
const de_UpdateDocumentResult = (output, context) => {
    return take(output, {
        DocumentDescription: (_) => de_DocumentDescription(_, context),
    });
};
const de_UpdateMaintenanceWindowTaskResult = (output, context) => {
    return take(output, {
        AlarmConfiguration: _json,
        CutoffBehavior: __expectString,
        Description: __expectString,
        LoggingInfo: _json,
        MaxConcurrency: __expectString,
        MaxErrors: __expectString,
        Name: __expectString,
        Priority: __expectInt32,
        ServiceRoleArn: __expectString,
        Targets: _json,
        TaskArn: __expectString,
        TaskInvocationParameters: (_) => de_MaintenanceWindowTaskInvocationParameters(_, context),
        TaskParameters: _json,
        WindowId: __expectString,
        WindowTaskId: __expectString,
    });
};
const de_UpdatePatchBaselineResult = (output, context) => {
    return take(output, {
        ApprovalRules: _json,
        ApprovedPatches: _json,
        ApprovedPatchesComplianceLevel: __expectString,
        ApprovedPatchesEnableNonSecurity: __expectBoolean,
        BaselineId: __expectString,
        CreatedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Description: __expectString,
        GlobalFilters: _json,
        ModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
        Name: __expectString,
        OperatingSystem: __expectString,
        RejectedPatches: _json,
        RejectedPatchesAction: __expectString,
        Sources: _json,
    });
};
const deserializeMetadata = (output) => ({
    httpStatusCode: output.statusCode,
    requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
    extendedRequestId: output.headers["x-amz-id-2"],
    cfId: output.headers["x-amz-cf-id"],
});
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
const throwDefaultError = withBaseException(__BaseException);
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
    const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
    const contents = {
        protocol,
        hostname,
        port,
        method: "POST",
        path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
        headers,
    };
    if (resolvedHostname !== undefined) {
        contents.hostname = resolvedHostname;
    }
    if (body !== undefined) {
        contents.body = body;
    }
    return new __HttpRequest(contents);
};
function sharedHeaders(operation) {
    return {
        "content-type": "application/x-amz-json-1.1",
        "x-amz-target": `AmazonSSM.${operation}`,
    };
}
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
    if (encoded.length) {
        return JSON.parse(encoded);
    }
    return {};
});
const parseErrorBody = async (errorBody, context) => {
    const value = await parseBody(errorBody, context);
    value.message = value.message ?? value.Message;
    return value;
};
const loadRestJsonErrorCode = (output, data) => {
    const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
    const sanitizeErrorCode = (rawValue) => {
        let cleanValue = rawValue;
        if (typeof cleanValue === "number") {
            cleanValue = cleanValue.toString();
        }
        if (cleanValue.indexOf(",") >= 0) {
            cleanValue = cleanValue.split(",")[0];
        }
        if (cleanValue.indexOf(":") >= 0) {
            cleanValue = cleanValue.split(":")[0];
        }
        if (cleanValue.indexOf("#") >= 0) {
            cleanValue = cleanValue.split("#")[1];
        }
        return cleanValue;
    };
    const headerKey = findKey(output.headers, "x-amzn-errortype");
    if (headerKey !== undefined) {
        return sanitizeErrorCode(output.headers[headerKey]);
    }
    if (data.code !== undefined) {
        return sanitizeErrorCode(data.code);
    }
    if (data["__type"] !== undefined) {
        return sanitizeErrorCode(data["__type"]);
    }
};
