import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectString as __expectString , limitedParseDouble as __limitedParseDouble , serializeFloat as __serializeFloat , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AssignInstanceCommandInput , AssignInstanceCommandOutput } from "../commands/AssignInstanceCommand" ; import { AssignVolumeCommandInput , AssignVolumeCommandOutput } from "../commands/AssignVolumeCommand" ; import { AssociateElasticIpCommandInput , AssociateElasticIpCommandOutput } from "../commands/AssociateElasticIpCommand" ; import { AttachElasticLoadBalancerCommandInput , AttachElasticLoadBalancerCommandOutput , } from "../commands/AttachElasticLoadBalancerCommand" ; import { CloneStackCommandInput , CloneStackCommandOutput } from "../commands/CloneStackCommand" ; import { CreateAppCommandInput , CreateAppCommandOutput } from "../commands/CreateAppCommand" ; import { CreateDeploymentCommandInput , CreateDeploymentCommandOutput } from "../commands/CreateDeploymentCommand" ; import { CreateInstanceCommandInput , CreateInstanceCommandOutput } from "../commands/CreateInstanceCommand" ; import { CreateLayerCommandInput , CreateLayerCommandOutput } from "../commands/CreateLayerCommand" ; import { CreateStackCommandInput , CreateStackCommandOutput } from "../commands/CreateStackCommand" ; import { CreateUserProfileCommandInput , CreateUserProfileCommandOutput } from "../commands/CreateUserProfileCommand" ; import { DeleteAppCommandInput , DeleteAppCommandOutput } from "../commands/DeleteAppCommand" ; import { DeleteInstanceCommandInput , DeleteInstanceCommandOutput } from "../commands/DeleteInstanceCommand" ; import { DeleteLayerCommandInput , DeleteLayerCommandOutput } from "../commands/DeleteLayerCommand" ; import { DeleteStackCommandInput , DeleteStackCommandOutput } from "../commands/DeleteStackCommand" ; import { DeleteUserProfileCommandInput , DeleteUserProfileCommandOutput } from "../commands/DeleteUserProfileCommand" ; import { DeregisterEcsClusterCommandInput , DeregisterEcsClusterCommandOutput , } from "../commands/DeregisterEcsClusterCommand" ; import { DeregisterElasticIpCommandInput , DeregisterElasticIpCommandOutput , } from "../commands/DeregisterElasticIpCommand" ; import { DeregisterInstanceCommandInput , DeregisterInstanceCommandOutput } from "../commands/DeregisterInstanceCommand" ; import { DeregisterRdsDbInstanceCommandInput , DeregisterRdsDbInstanceCommandOutput , } from "../commands/DeregisterRdsDbInstanceCommand" ; import { DeregisterVolumeCommandInput , DeregisterVolumeCommandOutput } from "../commands/DeregisterVolumeCommand" ; import { DescribeAgentVersionsCommandInput , DescribeAgentVersionsCommandOutput , } from "../commands/DescribeAgentVersionsCommand" ; import { DescribeAppsCommandInput , DescribeAppsCommandOutput } from "../commands/DescribeAppsCommand" ; import { DescribeCommandsCommandInput , DescribeCommandsCommandOutput } from "../commands/DescribeCommandsCommand" ; import { DescribeDeploymentsCommandInput , DescribeDeploymentsCommandOutput , } from "../commands/DescribeDeploymentsCommand" ; import { DescribeEcsClustersCommandInput , DescribeEcsClustersCommandOutput , } from "../commands/DescribeEcsClustersCommand" ; import { DescribeElasticIpsCommandInput , DescribeElasticIpsCommandOutput } from "../commands/DescribeElasticIpsCommand" ; import { DescribeElasticLoadBalancersCommandInput , DescribeElasticLoadBalancersCommandOutput , } from "../commands/DescribeElasticLoadBalancersCommand" ; import { DescribeInstancesCommandInput , DescribeInstancesCommandOutput } from "../commands/DescribeInstancesCommand" ; import { DescribeLayersCommandInput , DescribeLayersCommandOutput } from "../commands/DescribeLayersCommand" ; import { DescribeLoadBasedAutoScalingCommandInput , DescribeLoadBasedAutoScalingCommandOutput , } from "../commands/DescribeLoadBasedAutoScalingCommand" ; import { DescribeMyUserProfileCommandInput , DescribeMyUserProfileCommandOutput , } from "../commands/DescribeMyUserProfileCommand" ; import { DescribeOperatingSystemsCommandInput , DescribeOperatingSystemsCommandOutput , } from "../commands/DescribeOperatingSystemsCommand" ; import { DescribePermissionsCommandInput , DescribePermissionsCommandOutput , } from "../commands/DescribePermissionsCommand" ; import { DescribeRaidArraysCommandInput , DescribeRaidArraysCommandOutput } from "../commands/DescribeRaidArraysCommand" ; import { DescribeRdsDbInstancesCommandInput , DescribeRdsDbInstancesCommandOutput , } from "../commands/DescribeRdsDbInstancesCommand" ; import { DescribeServiceErrorsCommandInput , DescribeServiceErrorsCommandOutput , } from "../commands/DescribeServiceErrorsCommand" ; import { DescribeStackProvisioningParametersCommandInput , DescribeStackProvisioningParametersCommandOutput , } from "../commands/DescribeStackProvisioningParametersCommand" ; import { DescribeStacksCommandInput , DescribeStacksCommandOutput } from "../commands/DescribeStacksCommand" ; import { DescribeStackSummaryCommandInput , DescribeStackSummaryCommandOutput , } from "../commands/DescribeStackSummaryCommand" ; import { DescribeTimeBasedAutoScalingCommandInput , DescribeTimeBasedAutoScalingCommandOutput , } from "../commands/DescribeTimeBasedAutoScalingCommand" ; import { DescribeUserProfilesCommandInput , DescribeUserProfilesCommandOutput , } from "../commands/DescribeUserProfilesCommand" ; import { DescribeVolumesCommandInput , DescribeVolumesCommandOutput } from "../commands/DescribeVolumesCommand" ; import { DetachElasticLoadBalancerCommandInput , DetachElasticLoadBalancerCommandOutput , } from "../commands/DetachElasticLoadBalancerCommand" ; import { DisassociateElasticIpCommandInput , DisassociateElasticIpCommandOutput , } from "../commands/DisassociateElasticIpCommand" ; import { GetHostnameSuggestionCommandInput , GetHostnameSuggestionCommandOutput , } from "../commands/GetHostnameSuggestionCommand" ; import { GrantAccessCommandInput , GrantAccessCommandOutput } from "../commands/GrantAccessCommand" ; import { ListTagsCommandInput , ListTagsCommandOutput } from "../commands/ListTagsCommand" ; import { RebootInstanceCommandInput , RebootInstanceCommandOutput } from "../commands/RebootInstanceCommand" ; import { RegisterEcsClusterCommandInput , RegisterEcsClusterCommandOutput } from "../commands/RegisterEcsClusterCommand" ; import { RegisterElasticIpCommandInput , RegisterElasticIpCommandOutput } from "../commands/RegisterElasticIpCommand" ; import { RegisterInstanceCommandInput , RegisterInstanceCommandOutput } from "../commands/RegisterInstanceCommand" ; import { RegisterRdsDbInstanceCommandInput , RegisterRdsDbInstanceCommandOutput , } from "../commands/RegisterRdsDbInstanceCommand" ; import { RegisterVolumeCommandInput , RegisterVolumeCommandOutput } from "../commands/RegisterVolumeCommand" ; import { SetLoadBasedAutoScalingCommandInput , SetLoadBasedAutoScalingCommandOutput , } from "../commands/SetLoadBasedAutoScalingCommand" ; import { SetPermissionCommandInput , SetPermissionCommandOutput } from "../commands/SetPermissionCommand" ; import { SetTimeBasedAutoScalingCommandInput , SetTimeBasedAutoScalingCommandOutput , } from "../commands/SetTimeBasedAutoScalingCommand" ; import { StartInstanceCommandInput , StartInstanceCommandOutput } from "../commands/StartInstanceCommand" ; import { StartStackCommandInput , StartStackCommandOutput } from "../commands/StartStackCommand" ; import { StopInstanceCommandInput , StopInstanceCommandOutput } from "../commands/StopInstanceCommand" ; import { StopStackCommandInput , StopStackCommandOutput } from "../commands/StopStackCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UnassignInstanceCommandInput , UnassignInstanceCommandOutput } from "../commands/UnassignInstanceCommand" ; import { UnassignVolumeCommandInput , UnassignVolumeCommandOutput } from "../commands/UnassignVolumeCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateAppCommandInput , UpdateAppCommandOutput } from "../commands/UpdateAppCommand" ; import { UpdateElasticIpCommandInput , UpdateElasticIpCommandOutput } from "../commands/UpdateElasticIpCommand" ; import { UpdateInstanceCommandInput , UpdateInstanceCommandOutput } from "../commands/UpdateInstanceCommand" ; import { UpdateLayerCommandInput , UpdateLayerCommandOutput } from "../commands/UpdateLayerCommand" ; import { UpdateMyUserProfileCommandInput , UpdateMyUserProfileCommandOutput , } from "../commands/UpdateMyUserProfileCommand" ; import { UpdateRdsDbInstanceCommandInput , UpdateRdsDbInstanceCommandOutput , } from "../commands/UpdateRdsDbInstanceCommand" ; import { UpdateStackCommandInput , UpdateStackCommandOutput } from "../commands/UpdateStackCommand" ; import { UpdateUserProfileCommandInput , UpdateUserProfileCommandOutput } from "../commands/UpdateUserProfileCommand" ; import { UpdateVolumeCommandInput , UpdateVolumeCommandOutput } from "../commands/UpdateVolumeCommand" ; import { AgentVersion , App , AppAttributesKeys , AssignInstanceRequest , AssignVolumeRequest , AssociateElasticIpRequest , AttachElasticLoadBalancerRequest , AutoScalingThresholds , BlockDeviceMapping , ChefConfiguration , CloneStackRequest , CloneStackResult , CloudWatchLogsConfiguration , CloudWatchLogsLogStream , Command , CreateAppRequest , CreateAppResult , CreateDeploymentRequest , CreateDeploymentResult , CreateInstanceRequest , CreateInstanceResult , CreateLayerRequest , CreateLayerResult , CreateStackRequest , CreateStackResult , CreateUserProfileRequest , CreateUserProfileResult , DataSource , DeleteAppRequest , DeleteInstanceRequest , DeleteLayerRequest , DeleteStackRequest , DeleteUserProfileRequest , Deployment , DeploymentCommand , DeregisterEcsClusterRequest , DeregisterElasticIpRequest , DeregisterInstanceRequest , DeregisterRdsDbInstanceRequest , DeregisterVolumeRequest , DescribeAgentVersionsRequest , DescribeAgentVersionsResult , DescribeAppsRequest , DescribeAppsResult , DescribeCommandsRequest , DescribeCommandsResult , DescribeDeploymentsRequest , DescribeDeploymentsResult , DescribeEcsClustersRequest , DescribeEcsClustersResult , DescribeElasticIpsRequest , DescribeElasticIpsResult , DescribeElasticLoadBalancersRequest , DescribeElasticLoadBalancersResult , DescribeInstancesRequest , DescribeInstancesResult , DescribeLayersRequest , DescribeLayersResult , DescribeLoadBasedAutoScalingRequest , DescribeLoadBasedAutoScalingResult , DescribeMyUserProfileResult , DescribeOperatingSystemsResponse , DescribePermissionsRequest , DescribePermissionsResult , DescribeRaidArraysRequest , DescribeRaidArraysResult , DescribeRdsDbInstancesRequest , DescribeRdsDbInstancesResult , DescribeServiceErrorsRequest , DescribeServiceErrorsResult , DescribeStackProvisioningParametersRequest , DescribeStackProvisioningParametersResult , DescribeStacksRequest , DescribeStacksResult , DescribeStackSummaryRequest , DescribeStackSummaryResult , DescribeTimeBasedAutoScalingRequest , DescribeTimeBasedAutoScalingResult , DescribeUserProfilesRequest , DescribeUserProfilesResult , DescribeVolumesRequest , DescribeVolumesResult , DetachElasticLoadBalancerRequest , DisassociateElasticIpRequest , EbsBlockDevice , EcsCluster , ElasticIp , ElasticLoadBalancer , EnvironmentVariable , GetHostnameSuggestionRequest , GetHostnameSuggestionResult , GrantAccessRequest , GrantAccessResult , Instance , InstanceIdentity , InstancesCount , Layer , LayerAttributesKeys , LifecycleEventConfiguration , ListTagsRequest , ListTagsResult , LoadBasedAutoScalingConfiguration , OperatingSystem , OperatingSystemConfigurationManager , Permission , RaidArray , RdsDbInstance , RebootInstanceRequest , Recipes , RegisterEcsClusterRequest , RegisterEcsClusterResult , RegisterElasticIpRequest , RegisterElasticIpResult , RegisterInstanceRequest , RegisterInstanceResult , RegisterRdsDbInstanceRequest , RegisterVolumeRequest , RegisterVolumeResult , ReportedOs , ResourceNotFoundException , SelfUserProfile , ServiceError , SetLoadBasedAutoScalingRequest , SetPermissionRequest , SetTimeBasedAutoScalingRequest , ShutdownEventConfiguration , Source , SslConfiguration , Stack , StackAttributesKeys , StackConfigurationManager , StackSummary , StartInstanceRequest , StartStackRequest , StopInstanceRequest , StopStackRequest , TagResourceRequest , TemporaryCredential , TimeBasedAutoScalingConfiguration , UnassignInstanceRequest , UnassignVolumeRequest , UntagResourceRequest , UpdateAppRequest , UpdateElasticIpRequest , UpdateInstanceRequest , UpdateLayerRequest , UpdateMyUserProfileRequest , UpdateRdsDbInstanceRequest , UpdateStackRequest , UpdateUserProfileRequest , UpdateVolumeRequest , UserProfile , ValidationException , Volume , VolumeConfiguration , WeeklyAutoScalingSchedule , } from "../models/models_0" ; export const serializeAws_json1_1AssignInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.AssignInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AssignInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1AssignVolumeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.AssignVolume" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AssignVolumeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1AssociateElasticIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.AssociateElasticIp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AssociateElasticIpRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1AttachElasticLoadBalancerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.AttachElasticLoadBalancer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AttachElasticLoadBalancerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CloneStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CloneStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CloneStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateAppCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateApp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateAppRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateDeploymentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateDeployment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateDeploymentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateLayerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateLayer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateLayerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateUserProfileCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.CreateUserProfile" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateUserProfileRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteAppCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeleteApp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteAppRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeleteInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteLayerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeleteLayer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteLayerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeleteStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteUserProfileCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeleteUserProfile" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteUserProfileRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeregisterEcsClusterCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeregisterEcsCluster" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeregisterEcsClusterRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeregisterElasticIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeregisterElasticIp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeregisterElasticIpRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeregisterInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeregisterInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeregisterInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeregisterRdsDbInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeregisterRdsDbInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeregisterRdsDbInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeregisterVolumeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DeregisterVolume" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeregisterVolumeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeAgentVersionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeAgentVersions" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeAgentVersionsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeAppsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeApps" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeAppsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeCommandsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeCommands" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeCommandsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeDeploymentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeDeployments" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeDeploymentsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEcsClustersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeEcsClusters" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEcsClustersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeElasticIpsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeElasticIps" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeElasticIpsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeElasticLoadBalancersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeElasticLoadBalancers" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeElasticLoadBalancersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeInstancesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeInstances" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeInstancesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeLayersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeLayers" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeLayersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeLoadBasedAutoScalingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeLoadBasedAutoScaling" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeLoadBasedAutoScalingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeMyUserProfileCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeMyUserProfile" , } ; const body = "{}" ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeOperatingSystemsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeOperatingSystems" , } ; const body = "{}" ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribePermissionsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribePermissions" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribePermissionsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeRaidArraysCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeRaidArrays" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeRaidArraysRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeRdsDbInstancesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeRdsDbInstances" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeRdsDbInstancesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeServiceErrorsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeServiceErrors" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeServiceErrorsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeStackProvisioningParametersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeStackProvisioningParameters" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeStackProvisioningParametersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeStacksCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeStacks" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeStacksRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeStackSummaryCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeStackSummary" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeStackSummaryRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeTimeBasedAutoScalingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeTimeBasedAutoScaling" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeTimeBasedAutoScalingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeUserProfilesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeUserProfiles" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeUserProfilesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeVolumesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DescribeVolumes" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeVolumesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetachElasticLoadBalancerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DetachElasticLoadBalancer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetachElasticLoadBalancerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DisassociateElasticIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.DisassociateElasticIp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DisassociateElasticIpRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetHostnameSuggestionCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.GetHostnameSuggestion" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetHostnameSuggestionRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GrantAccessCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.GrantAccess" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GrantAccessRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.ListTags" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RebootInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RebootInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RebootInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RegisterEcsClusterCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RegisterEcsCluster" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RegisterEcsClusterRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RegisterElasticIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RegisterElasticIp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RegisterElasticIpRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RegisterInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RegisterInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RegisterInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RegisterRdsDbInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RegisterRdsDbInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RegisterRdsDbInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RegisterVolumeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.RegisterVolume" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RegisterVolumeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetLoadBasedAutoScalingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.SetLoadBasedAutoScaling" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetLoadBasedAutoScalingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetPermissionCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.SetPermission" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetPermissionRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetTimeBasedAutoScalingCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.SetTimeBasedAutoScaling" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetTimeBasedAutoScalingRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.StartInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.StartStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.StopInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.StopStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.TagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1TagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UnassignInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UnassignInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UnassignInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UnassignVolumeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UnassignVolume" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UnassignVolumeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UntagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UntagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateAppCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateApp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateAppRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateElasticIpCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateElasticIp" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateElasticIpRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateLayerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateLayer" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateLayerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateMyUserProfileCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateMyUserProfile" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateMyUserProfileRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateRdsDbInstanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateRdsDbInstance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateRdsDbInstanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateStackCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateStack" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateStackRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateUserProfileCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateUserProfile" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateUserProfileRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateVolumeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "OpsWorks_20130218.UpdateVolume" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateVolumeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1AssignInstanceCommand = async ( output , context ) : Promise < AssignInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AssignInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AssignInstanceCommandError = async ( output , context ) : Promise < AssignInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1AssignVolumeCommand = async ( output , context ) : Promise < AssignVolumeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AssignVolumeCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AssignVolumeCommandError = async ( output , context ) : Promise < AssignVolumeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1AssociateElasticIpCommand = async ( output , context ) : Promise < AssociateElasticIpCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AssociateElasticIpCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AssociateElasticIpCommandError = async ( output , context ) : Promise < AssociateElasticIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1AttachElasticLoadBalancerCommand = async ( output , context ) : Promise < AttachElasticLoadBalancerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AttachElasticLoadBalancerCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AttachElasticLoadBalancerCommandError = async ( output , context ) : Promise < AttachElasticLoadBalancerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CloneStackCommand = async ( output , context ) : Promise < CloneStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CloneStackCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CloneStackResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CloneStackCommandError = async ( output , context ) : Promise < CloneStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateAppCommand = async ( output , context ) : Promise < CreateAppCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateAppCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateAppResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateAppCommandError = async ( output , context ) : Promise < CreateAppCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateDeploymentCommand = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateDeploymentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateDeploymentResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateDeploymentCommandError = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateInstanceCommand = async ( output , context ) : Promise < CreateInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateInstanceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateInstanceResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateInstanceCommandError = async ( output , context ) : Promise < CreateInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateLayerCommand = async ( output , context ) : Promise < CreateLayerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateLayerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateLayerResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateLayerCommandError = async ( output , context ) : Promise < CreateLayerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateStackCommand = async ( output , context ) : Promise < CreateStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateStackCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateStackResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateStackCommandError = async ( output , context ) : Promise < CreateStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1CreateUserProfileCommand = async ( output , context ) : Promise < CreateUserProfileCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateUserProfileCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateUserProfileResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateUserProfileCommandError = async ( output , context ) : Promise < CreateUserProfileCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteAppCommand = async ( output , context ) : Promise < DeleteAppCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteAppCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteAppCommandError = async ( output , context ) : Promise < DeleteAppCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteInstanceCommand = async ( output , context ) : Promise < DeleteInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteInstanceCommandError = async ( output , context ) : Promise < DeleteInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteLayerCommand = async ( output , context ) : Promise < DeleteLayerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteLayerCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteLayerCommandError = async ( output , context ) : Promise < DeleteLayerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteStackCommand = async ( output , context ) : Promise < DeleteStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteStackCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteStackCommandError = async ( output , context ) : Promise < DeleteStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeleteUserProfileCommand = async ( output , context ) : Promise < DeleteUserProfileCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteUserProfileCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteUserProfileCommandError = async ( output , context ) : Promise < DeleteUserProfileCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeregisterEcsClusterCommand = async ( output , context ) : Promise < DeregisterEcsClusterCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeregisterEcsClusterCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeregisterEcsClusterCommandError = async ( output , context ) : Promise < DeregisterEcsClusterCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeregisterElasticIpCommand = async ( output , context ) : Promise < DeregisterElasticIpCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeregisterElasticIpCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeregisterElasticIpCommandError = async ( output , context ) : Promise < DeregisterElasticIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeregisterInstanceCommand = async ( output , context ) : Promise < DeregisterInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeregisterInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeregisterInstanceCommandError = async ( output , context ) : Promise < DeregisterInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeregisterRdsDbInstanceCommand = async ( output , context ) : Promise < DeregisterRdsDbInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeregisterRdsDbInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeregisterRdsDbInstanceCommandError = async ( output , context ) : Promise < DeregisterRdsDbInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DeregisterVolumeCommand = async ( output , context ) : Promise < DeregisterVolumeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeregisterVolumeCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeregisterVolumeCommandError = async ( output , context ) : Promise < DeregisterVolumeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeAgentVersionsCommand = async ( output , context ) : Promise < DescribeAgentVersionsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeAgentVersionsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeAgentVersionsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeAgentVersionsCommandError = async ( output , context ) : Promise < DescribeAgentVersionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeAppsCommand = async ( output , context ) : Promise < DescribeAppsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeAppsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeAppsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeAppsCommandError = async ( output , context ) : Promise < DescribeAppsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeCommandsCommand = async ( output , context ) : Promise < DescribeCommandsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeCommandsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeCommandsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeCommandsCommandError = async ( output , context ) : Promise < DescribeCommandsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeDeploymentsCommand = async ( output , context ) : Promise < DescribeDeploymentsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeDeploymentsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeDeploymentsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeDeploymentsCommandError = async ( output , context ) : Promise < DescribeDeploymentsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeEcsClustersCommand = async ( output , context ) : Promise < DescribeEcsClustersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEcsClustersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEcsClustersResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEcsClustersCommandError = async ( output , context ) : Promise < DescribeEcsClustersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeElasticIpsCommand = async ( output , context ) : Promise < DescribeElasticIpsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeElasticIpsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeElasticIpsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeElasticIpsCommandError = async ( output , context ) : Promise < DescribeElasticIpsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeElasticLoadBalancersCommand = async ( output , context ) : Promise < DescribeElasticLoadBalancersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeElasticLoadBalancersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeElasticLoadBalancersResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeElasticLoadBalancersCommandError = async ( output , context ) : Promise < DescribeElasticLoadBalancersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeInstancesCommand = async ( output , context ) : Promise < DescribeInstancesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeInstancesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeInstancesResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeInstancesCommandError = async ( output , context ) : Promise < DescribeInstancesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeLayersCommand = async ( output , context ) : Promise < DescribeLayersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeLayersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeLayersResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeLayersCommandError = async ( output , context ) : Promise < DescribeLayersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeLoadBasedAutoScalingCommand = async ( output , context ) : Promise < DescribeLoadBasedAutoScalingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeLoadBasedAutoScalingCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeLoadBasedAutoScalingResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeLoadBasedAutoScalingCommandError = async ( output , context ) : Promise < DescribeLoadBasedAutoScalingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeMyUserProfileCommand = async ( output , context ) : Promise < DescribeMyUserProfileCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeMyUserProfileCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeMyUserProfileResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeMyUserProfileCommandError = async ( output , context ) : Promise < DescribeMyUserProfileCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeOperatingSystemsCommand = async ( output , context ) : Promise < DescribeOperatingSystemsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeOperatingSystemsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeOperatingSystemsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeOperatingSystemsCommandError = async ( output , context ) : Promise < DescribeOperatingSystemsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribePermissionsCommand = async ( output , context ) : Promise < DescribePermissionsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribePermissionsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribePermissionsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribePermissionsCommandError = async ( output , context ) : Promise < DescribePermissionsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeRaidArraysCommand = async ( output , context ) : Promise < DescribeRaidArraysCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeRaidArraysCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeRaidArraysResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeRaidArraysCommandError = async ( output , context ) : Promise < DescribeRaidArraysCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeRdsDbInstancesCommand = async ( output , context ) : Promise < DescribeRdsDbInstancesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeRdsDbInstancesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeRdsDbInstancesResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeRdsDbInstancesCommandError = async ( output , context ) : Promise < DescribeRdsDbInstancesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeServiceErrorsCommand = async ( output , context ) : Promise < DescribeServiceErrorsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeServiceErrorsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeServiceErrorsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeServiceErrorsCommandError = async ( output , context ) : Promise < DescribeServiceErrorsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeStackProvisioningParametersCommand = async ( output , context ) : Promise < DescribeStackProvisioningParametersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeStackProvisioningParametersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeStackProvisioningParametersResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeStackProvisioningParametersCommandError = async ( output , context ) : Promise < DescribeStackProvisioningParametersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeStacksCommand = async ( output , context ) : Promise < DescribeStacksCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeStacksCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeStacksResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeStacksCommandError = async ( output , context ) : Promise < DescribeStacksCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeStackSummaryCommand = async ( output , context ) : Promise < DescribeStackSummaryCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeStackSummaryCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeStackSummaryResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeStackSummaryCommandError = async ( output , context ) : Promise < DescribeStackSummaryCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeTimeBasedAutoScalingCommand = async ( output , context ) : Promise < DescribeTimeBasedAutoScalingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeTimeBasedAutoScalingCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeTimeBasedAutoScalingResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeTimeBasedAutoScalingCommandError = async ( output , context ) : Promise < DescribeTimeBasedAutoScalingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeUserProfilesCommand = async ( output , context ) : Promise < DescribeUserProfilesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeUserProfilesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeUserProfilesResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeUserProfilesCommandError = async ( output , context ) : Promise < DescribeUserProfilesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeVolumesCommand = async ( output , context ) : Promise < DescribeVolumesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeVolumesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeVolumesResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeVolumesCommandError = async ( output , context ) : Promise < DescribeVolumesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DetachElasticLoadBalancerCommand = async ( output , context ) : Promise < DetachElasticLoadBalancerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetachElasticLoadBalancerCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetachElasticLoadBalancerCommandError = async ( output , context ) : Promise < DetachElasticLoadBalancerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DisassociateElasticIpCommand = async ( output , context ) : Promise < DisassociateElasticIpCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DisassociateElasticIpCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DisassociateElasticIpCommandError = async ( output , context ) : Promise < DisassociateElasticIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GetHostnameSuggestionCommand = async ( output , context ) : Promise < GetHostnameSuggestionCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetHostnameSuggestionCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetHostnameSuggestionResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetHostnameSuggestionCommandError = async ( output , context ) : Promise < GetHostnameSuggestionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1GrantAccessCommand = async ( output , context ) : Promise < GrantAccessCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GrantAccessCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GrantAccessResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GrantAccessCommandError = async ( output , context ) : Promise < GrantAccessCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListTagsCommand = async ( output , context ) : Promise < ListTagsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsCommandError = async ( output , context ) : Promise < ListTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RebootInstanceCommand = async ( output , context ) : Promise < RebootInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RebootInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RebootInstanceCommandError = async ( output , context ) : Promise < RebootInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RegisterEcsClusterCommand = async ( output , context ) : Promise < RegisterEcsClusterCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RegisterEcsClusterCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RegisterEcsClusterResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RegisterEcsClusterCommandError = async ( output , context ) : Promise < RegisterEcsClusterCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RegisterElasticIpCommand = async ( output , context ) : Promise < RegisterElasticIpCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RegisterElasticIpCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RegisterElasticIpResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RegisterElasticIpCommandError = async ( output , context ) : Promise < RegisterElasticIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RegisterInstanceCommand = async ( output , context ) : Promise < RegisterInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RegisterInstanceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RegisterInstanceResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RegisterInstanceCommandError = async ( output , context ) : Promise < RegisterInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RegisterRdsDbInstanceCommand = async ( output , context ) : Promise < RegisterRdsDbInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RegisterRdsDbInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RegisterRdsDbInstanceCommandError = async ( output , context ) : Promise < RegisterRdsDbInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1RegisterVolumeCommand = async ( output , context ) : Promise < RegisterVolumeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RegisterVolumeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RegisterVolumeResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RegisterVolumeCommandError = async ( output , context ) : Promise < RegisterVolumeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1SetLoadBasedAutoScalingCommand = async ( output , context ) : Promise < SetLoadBasedAutoScalingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetLoadBasedAutoScalingCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetLoadBasedAutoScalingCommandError = async ( output , context ) : Promise < SetLoadBasedAutoScalingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1SetPermissionCommand = async ( output , context ) : Promise < SetPermissionCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetPermissionCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetPermissionCommandError = async ( output , context ) : Promise < SetPermissionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1SetTimeBasedAutoScalingCommand = async ( output , context ) : Promise < SetTimeBasedAutoScalingCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetTimeBasedAutoScalingCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetTimeBasedAutoScalingCommandError = async ( output , context ) : Promise < SetTimeBasedAutoScalingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartInstanceCommand = async ( output , context ) : Promise < StartInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartInstanceCommandError = async ( output , context ) : Promise < StartInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartStackCommand = async ( output , context ) : Promise < StartStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartStackCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartStackCommandError = async ( output , context ) : Promise < StartStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopInstanceCommand = async ( output , context ) : Promise < StopInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopInstanceCommandError = async ( output , context ) : Promise < StopInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopStackCommand = async ( output , context ) : Promise < StopStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopStackCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopStackCommandError = async ( output , context ) : Promise < StopStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1TagResourceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UnassignInstanceCommand = async ( output , context ) : Promise < UnassignInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UnassignInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UnassignInstanceCommandError = async ( output , context ) : Promise < UnassignInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UnassignVolumeCommand = async ( output , context ) : Promise < UnassignVolumeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UnassignVolumeCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UnassignVolumeCommandError = async ( output , context ) : Promise < UnassignVolumeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UntagResourceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateAppCommand = async ( output , context ) : Promise < UpdateAppCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateAppCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateAppCommandError = async ( output , context ) : Promise < UpdateAppCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateElasticIpCommand = async ( output , context ) : Promise < UpdateElasticIpCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateElasticIpCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateElasticIpCommandError = async ( output , context ) : Promise < UpdateElasticIpCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateInstanceCommand = async ( output , context ) : Promise < UpdateInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateInstanceCommandError = async ( output , context ) : Promise < UpdateInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateLayerCommand = async ( output , context ) : Promise < UpdateLayerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateLayerCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateLayerCommandError = async ( output , context ) : Promise < UpdateLayerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateMyUserProfileCommand = async ( output , context ) : Promise < UpdateMyUserProfileCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateMyUserProfileCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateMyUserProfileCommandError = async ( output , context ) : Promise < UpdateMyUserProfileCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateRdsDbInstanceCommand = async ( output , context ) : Promise < UpdateRdsDbInstanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateRdsDbInstanceCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateRdsDbInstanceCommandError = async ( output , context ) : Promise < UpdateRdsDbInstanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateStackCommand = async ( output , context ) : Promise < UpdateStackCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateStackCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateStackCommandError = async ( output , context ) : Promise < UpdateStackCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateUserProfileCommand = async ( output , context ) : Promise < UpdateUserProfileCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateUserProfileCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateUserProfileCommandError = async ( output , context ) : Promise < UpdateUserProfileCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1UpdateVolumeCommand = async ( output , context ) : Promise < UpdateVolumeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateVolumeCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateVolumeCommandError = async ( output , context ) : Promise < UpdateVolumeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.opsworks#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.opsworks#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceNotFoundException ( body , context ) ; const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ValidationException ( body , context ) ; const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1AppAttributes = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1AssignInstanceRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , } ; } ; const serializeAws_json1_1AssignVolumeRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . VolumeId !== undefined && input . VolumeId !== null && { VolumeId : input . VolumeId } ) , } ; } ; const serializeAws_json1_1AssociateElasticIpRequest = ( input , context ) : any => { return { ... ( input . ElasticIp !== undefined && input . ElasticIp !== null && { ElasticIp : input . ElasticIp } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1AttachElasticLoadBalancerRequest = ( input , context ) : any => { return { ... ( input . ElasticLoadBalancerName !== undefined && input . ElasticLoadBalancerName !== null && { ElasticLoadBalancerName : input . ElasticLoadBalancerName } ) , ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , } ; } ; const serializeAws_json1_1AutoScalingThresholds = ( input , context ) : any => { return { ... ( input . Alarms !== undefined && input . Alarms !== null && { Alarms : serializeAws_json1_1Strings ( input . Alarms , context ) } ) , ... ( input . CpuThreshold !== undefined && input . CpuThreshold !== null && { CpuThreshold : __serializeFloat ( input . CpuThreshold ) } ) , ... ( input . IgnoreMetricsTime !== undefined && input . IgnoreMetricsTime !== null && { IgnoreMetricsTime : input . IgnoreMetricsTime } ) , ... ( input . InstanceCount !== undefined && input . InstanceCount !== null && { InstanceCount : input . InstanceCount } ) , ... ( input . LoadThreshold !== undefined && input . LoadThreshold !== null && { LoadThreshold : __serializeFloat ( input . LoadThreshold ) } ) , ... ( input . MemoryThreshold !== undefined && input . MemoryThreshold !== null && { MemoryThreshold : __serializeFloat ( input . MemoryThreshold ) } ) , ... ( input . ThresholdsWaitTime !== undefined && input . ThresholdsWaitTime !== null && { ThresholdsWaitTime : input . ThresholdsWaitTime } ) , } ; } ; const serializeAws_json1_1BlockDeviceMapping = ( input , context ) : any => { return { ... ( input . DeviceName !== undefined && input . DeviceName !== null && { DeviceName : input . DeviceName } ) , ... ( input . Ebs !== undefined && input . Ebs !== null && { Ebs : serializeAws_json1_1EbsBlockDevice ( input . Ebs , context ) } ) , ... ( input . NoDevice !== undefined && input . NoDevice !== null && { NoDevice : input . NoDevice } ) , ... ( input . VirtualName !== undefined && input . VirtualName !== null && { VirtualName : input . VirtualName } ) , } ; } ; const serializeAws_json1_1BlockDeviceMappings = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1BlockDeviceMapping ( entry , context ) ; } ) ; } ; const serializeAws_json1_1ChefConfiguration = ( input , context ) : any => { return { ... ( input . BerkshelfVersion !== undefined && input . BerkshelfVersion !== null && { BerkshelfVersion : input . BerkshelfVersion } ) , ... ( input . ManageBerkshelf !== undefined && input . ManageBerkshelf !== null && { ManageBerkshelf : input . ManageBerkshelf } ) , } ; } ; const serializeAws_json1_1CloneStackRequest = ( input , context ) : any => { return { ... ( input . AgentVersion !== undefined && input . AgentVersion !== null && { AgentVersion : input . AgentVersion } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1StackAttributes ( input . Attributes , context ) } ) , ... ( input . ChefConfiguration !== undefined && input . ChefConfiguration !== null && { ChefConfiguration : serializeAws_json1_1ChefConfiguration ( input . ChefConfiguration , context ) , } ) , ... ( input . CloneAppIds !== undefined && input . CloneAppIds !== null && { CloneAppIds : serializeAws_json1_1Strings ( input . CloneAppIds , context ) } ) , ... ( input . ClonePermissions !== undefined && input . ClonePermissions !== null && { ClonePermissions : input . ClonePermissions } ) , ... ( input . ConfigurationManager !== undefined && input . ConfigurationManager !== null && { ConfigurationManager : serializeAws_json1_1StackConfigurationManager ( input . ConfigurationManager , context ) , } ) , ... ( input . CustomCookbooksSource !== undefined && input . CustomCookbooksSource !== null && { CustomCookbooksSource : serializeAws_json1_1Source ( input . CustomCookbooksSource , context ) , } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . DefaultAvailabilityZone !== undefined && input . DefaultAvailabilityZone !== null && { DefaultAvailabilityZone : input . DefaultAvailabilityZone } ) , ... ( input . DefaultInstanceProfileArn !== undefined && input . DefaultInstanceProfileArn !== null && { DefaultInstanceProfileArn : input . DefaultInstanceProfileArn } ) , ... ( input . DefaultOs !== undefined && input . DefaultOs !== null && { DefaultOs : input . DefaultOs } ) , ... ( input . DefaultRootDeviceType !== undefined && input . DefaultRootDeviceType !== null && { DefaultRootDeviceType : input . DefaultRootDeviceType } ) , ... ( input . DefaultSshKeyName !== undefined && input . DefaultSshKeyName !== null && { DefaultSshKeyName : input . DefaultSshKeyName } ) , ... ( input . DefaultSubnetId !== undefined && input . DefaultSubnetId !== null && { DefaultSubnetId : input . DefaultSubnetId } ) , ... ( input . HostnameTheme !== undefined && input . HostnameTheme !== null && { HostnameTheme : input . HostnameTheme } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Region !== undefined && input . Region !== null && { Region : input . Region } ) , ... ( input . ServiceRoleArn !== undefined && input . ServiceRoleArn !== null && { ServiceRoleArn : input . ServiceRoleArn } ) , ... ( input . SourceStackId !== undefined && input . SourceStackId !== null && { SourceStackId : input . SourceStackId } ) , ... ( input . UseCustomCookbooks !== undefined && input . UseCustomCookbooks !== null && { UseCustomCookbooks : input . UseCustomCookbooks } ) , ... ( input . UseOpsworksSecurityGroups !== undefined && input . UseOpsworksSecurityGroups !== null && { UseOpsworksSecurityGroups : input . UseOpsworksSecurityGroups } ) , ... ( input . VpcId !== undefined && input . VpcId !== null && { VpcId : input . VpcId } ) , } ; } ; const serializeAws_json1_1CloudWatchLogsConfiguration = ( input , context ) : any => { return { ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . LogStreams !== undefined && input . LogStreams !== null && { LogStreams : serializeAws_json1_1CloudWatchLogsLogStreams ( input . LogStreams , context ) , } ) , } ; } ; const serializeAws_json1_1CloudWatchLogsLogStream = ( input , context ) : any => { return { ... ( input . BatchCount !== undefined && input . BatchCount !== null && { BatchCount : input . BatchCount } ) , ... ( input . BatchSize !== undefined && input . BatchSize !== null && { BatchSize : input . BatchSize } ) , ... ( input . BufferDuration !== undefined && input . BufferDuration !== null && { BufferDuration : input . BufferDuration } ) , ... ( input . DatetimeFormat !== undefined && input . DatetimeFormat !== null && { DatetimeFormat : input . DatetimeFormat } ) , ... ( input . Encoding !== undefined && input . Encoding !== null && { Encoding : input . Encoding } ) , ... ( input . File !== undefined && input . File !== null && { File : input . File } ) , ... ( input . FileFingerprintLines !== undefined && input . FileFingerprintLines !== null && { FileFingerprintLines : input . FileFingerprintLines } ) , ... ( input . InitialPosition !== undefined && input . InitialPosition !== null && { InitialPosition : input . InitialPosition } ) , ... ( input . LogGroupName !== undefined && input . LogGroupName !== null && { LogGroupName : input . LogGroupName } ) , ... ( input . MultiLineStartPattern !== undefined && input . MultiLineStartPattern !== null && { MultiLineStartPattern : input . MultiLineStartPattern } ) , ... ( input . TimeZone !== undefined && input . TimeZone !== null && { TimeZone : input . TimeZone } ) , } ; } ; const serializeAws_json1_1CloudWatchLogsLogStreams = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1CloudWatchLogsLogStream ( entry , context ) ; } ) ; } ; const serializeAws_json1_1CreateAppRequest = ( input , context ) : any => { return { ... ( input . AppSource !== undefined && input . AppSource !== null && { AppSource : serializeAws_json1_1Source ( input . AppSource , context ) } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1AppAttributes ( input . Attributes , context ) } ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { DataSources : serializeAws_json1_1DataSources ( input . DataSources , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Domains !== undefined && input . Domains !== null && { Domains : serializeAws_json1_1Strings ( input . Domains , context ) } ) , ... ( input . EnableSsl !== undefined && input . EnableSsl !== null && { EnableSsl : input . EnableSsl } ) , ... ( input . Environment !== undefined && input . Environment !== null && { Environment : serializeAws_json1_1EnvironmentVariables ( input . Environment , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Shortname !== undefined && input . Shortname !== null && { Shortname : input . Shortname } ) , ... ( input . SslConfiguration !== undefined && input . SslConfiguration !== null && { SslConfiguration : serializeAws_json1_1SslConfiguration ( input . SslConfiguration , context ) , } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_json1_1CreateDeploymentRequest = ( input , context ) : any => { return { ... ( input . AppId !== undefined && input . AppId !== null && { AppId : input . AppId } ) , ... ( input . Command !== undefined && input . Command !== null && { Command : serializeAws_json1_1DeploymentCommand ( input . Command , context ) } ) , ... ( input . Comment !== undefined && input . Comment !== null && { Comment : input . Comment } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . InstanceIds !== undefined && input . InstanceIds !== null && { InstanceIds : serializeAws_json1_1Strings ( input . InstanceIds , context ) } ) , ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1CreateInstanceRequest = ( input , context ) : any => { return { ... ( input . AgentVersion !== undefined && input . AgentVersion !== null && { AgentVersion : input . AgentVersion } ) , ... ( input . AmiId !== undefined && input . AmiId !== null && { AmiId : input . AmiId } ) , ... ( input . Architecture !== undefined && input . Architecture !== null && { Architecture : input . Architecture } ) , ... ( input . AutoScalingType !== undefined && input . AutoScalingType !== null && { AutoScalingType : input . AutoScalingType } ) , ... ( input . AvailabilityZone !== undefined && input . AvailabilityZone !== null && { AvailabilityZone : input . AvailabilityZone } ) , ... ( input . BlockDeviceMappings !== undefined && input . BlockDeviceMappings !== null && { BlockDeviceMappings : serializeAws_json1_1BlockDeviceMappings ( input . BlockDeviceMappings , context ) , } ) , ... ( input . EbsOptimized !== undefined && input . EbsOptimized !== null && { EbsOptimized : input . EbsOptimized } ) , ... ( input . Hostname !== undefined && input . Hostname !== null && { Hostname : input . Hostname } ) , ... ( input . InstallUpdatesOnBoot !== undefined && input . InstallUpdatesOnBoot !== null && { InstallUpdatesOnBoot : input . InstallUpdatesOnBoot } ) , ... ( input . InstanceType !== undefined && input . InstanceType !== null && { InstanceType : input . InstanceType } ) , ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , ... ( input . Os !== undefined && input . Os !== null && { Os : input . Os } ) , ... ( input . RootDeviceType !== undefined && input . RootDeviceType !== null && { RootDeviceType : input . RootDeviceType } ) , ... ( input . SshKeyName !== undefined && input . SshKeyName !== null && { SshKeyName : input . SshKeyName } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , ... ( input . SubnetId !== undefined && input . SubnetId !== null && { SubnetId : input . SubnetId } ) , ... ( input . Tenancy !== undefined && input . Tenancy !== null && { Tenancy : input . Tenancy } ) , ... ( input . VirtualizationType !== undefined && input . VirtualizationType !== null && { VirtualizationType : input . VirtualizationType } ) , } ; } ; const serializeAws_json1_1CreateLayerRequest = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1LayerAttributes ( input . Attributes , context ) } ) , ... ( input . AutoAssignElasticIps !== undefined && input . AutoAssignElasticIps !== null && { AutoAssignElasticIps : input . AutoAssignElasticIps } ) , ... ( input . AutoAssignPublicIps !== undefined && input . AutoAssignPublicIps !== null && { AutoAssignPublicIps : input . AutoAssignPublicIps } ) , ... ( input . CloudWatchLogsConfiguration !== undefined && input . CloudWatchLogsConfiguration !== null && { CloudWatchLogsConfiguration : serializeAws_json1_1CloudWatchLogsConfiguration ( input . CloudWatchLogsConfiguration , context ) , } ) , ... ( input . CustomInstanceProfileArn !== undefined && input . CustomInstanceProfileArn !== null && { CustomInstanceProfileArn : input . CustomInstanceProfileArn } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . CustomRecipes !== undefined && input . CustomRecipes !== null && { CustomRecipes : serializeAws_json1_1Recipes ( input . CustomRecipes , context ) } ) , ... ( input . CustomSecurityGroupIds !== undefined && input . CustomSecurityGroupIds !== null && { CustomSecurityGroupIds : serializeAws_json1_1Strings ( input . CustomSecurityGroupIds , context ) , } ) , ... ( input . EnableAutoHealing !== undefined && input . EnableAutoHealing !== null && { EnableAutoHealing : input . EnableAutoHealing } ) , ... ( input . InstallUpdatesOnBoot !== undefined && input . InstallUpdatesOnBoot !== null && { InstallUpdatesOnBoot : input . InstallUpdatesOnBoot } ) , ... ( input . LifecycleEventConfiguration !== undefined && input . LifecycleEventConfiguration !== null && { LifecycleEventConfiguration : serializeAws_json1_1LifecycleEventConfiguration ( input . LifecycleEventConfiguration , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Packages !== undefined && input . Packages !== null && { Packages : serializeAws_json1_1Strings ( input . Packages , context ) } ) , ... ( input . Shortname !== undefined && input . Shortname !== null && { Shortname : input . Shortname } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . UseEbsOptimizedInstances !== undefined && input . UseEbsOptimizedInstances !== null && { UseEbsOptimizedInstances : input . UseEbsOptimizedInstances } ) , ... ( input . VolumeConfigurations !== undefined && input . VolumeConfigurations !== null && { VolumeConfigurations : serializeAws_json1_1VolumeConfigurations ( input . VolumeConfigurations , context ) , } ) , } ; } ; const serializeAws_json1_1CreateStackRequest = ( input , context ) : any => { return { ... ( input . AgentVersion !== undefined && input . AgentVersion !== null && { AgentVersion : input . AgentVersion } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1StackAttributes ( input . Attributes , context ) } ) , ... ( input . ChefConfiguration !== undefined && input . ChefConfiguration !== null && { ChefConfiguration : serializeAws_json1_1ChefConfiguration ( input . ChefConfiguration , context ) , } ) , ... ( input . ConfigurationManager !== undefined && input . ConfigurationManager !== null && { ConfigurationManager : serializeAws_json1_1StackConfigurationManager ( input . ConfigurationManager , context ) , } ) , ... ( input . CustomCookbooksSource !== undefined && input . CustomCookbooksSource !== null && { CustomCookbooksSource : serializeAws_json1_1Source ( input . CustomCookbooksSource , context ) , } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . DefaultAvailabilityZone !== undefined && input . DefaultAvailabilityZone !== null && { DefaultAvailabilityZone : input . DefaultAvailabilityZone } ) , ... ( input . DefaultInstanceProfileArn !== undefined && input . DefaultInstanceProfileArn !== null && { DefaultInstanceProfileArn : input . DefaultInstanceProfileArn } ) , ... ( input . DefaultOs !== undefined && input . DefaultOs !== null && { DefaultOs : input . DefaultOs } ) , ... ( input . DefaultRootDeviceType !== undefined && input . DefaultRootDeviceType !== null && { DefaultRootDeviceType : input . DefaultRootDeviceType } ) , ... ( input . DefaultSshKeyName !== undefined && input . DefaultSshKeyName !== null && { DefaultSshKeyName : input . DefaultSshKeyName } ) , ... ( input . DefaultSubnetId !== undefined && input . DefaultSubnetId !== null && { DefaultSubnetId : input . DefaultSubnetId } ) , ... ( input . HostnameTheme !== undefined && input . HostnameTheme !== null && { HostnameTheme : input . HostnameTheme } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Region !== undefined && input . Region !== null && { Region : input . Region } ) , ... ( input . ServiceRoleArn !== undefined && input . ServiceRoleArn !== null && { ServiceRoleArn : input . ServiceRoleArn } ) , ... ( input . UseCustomCookbooks !== undefined && input . UseCustomCookbooks !== null && { UseCustomCookbooks : input . UseCustomCookbooks } ) , ... ( input . UseOpsworksSecurityGroups !== undefined && input . UseOpsworksSecurityGroups !== null && { UseOpsworksSecurityGroups : input . UseOpsworksSecurityGroups } ) , ... ( input . VpcId !== undefined && input . VpcId !== null && { VpcId : input . VpcId } ) , } ; } ; const serializeAws_json1_1CreateUserProfileRequest = ( input , context ) : any => { return { ... ( input . AllowSelfManagement !== undefined && input . AllowSelfManagement !== null && { AllowSelfManagement : input . AllowSelfManagement } ) , ... ( input . IamUserArn !== undefined && input . IamUserArn !== null && { IamUserArn : input . IamUserArn } ) , ... ( input . SshPublicKey !== undefined && input . SshPublicKey !== null && { SshPublicKey : input . SshPublicKey } ) , ... ( input . SshUsername !== undefined && input . SshUsername !== null && { SshUsername : input . SshUsername } ) , } ; } ; const serializeAws_json1_1DailyAutoScalingSchedule = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1DataSource = ( input , context ) : any => { return { ... ( input . Arn !== undefined && input . Arn !== null && { Arn : input . Arn } ) , ... ( input . DatabaseName !== undefined && input . DatabaseName !== null && { DatabaseName : input . DatabaseName } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_json1_1DataSources = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1DataSource ( entry , context ) ; } ) ; } ; const serializeAws_json1_1DeleteAppRequest = ( input , context ) : any => { return { ... ( input . AppId !== undefined && input . AppId !== null && { AppId : input . AppId } ) , } ; } ; const serializeAws_json1_1DeleteInstanceRequest = ( input , context ) : any => { return { ... ( input . DeleteElasticIp !== undefined && input . DeleteElasticIp !== null && { DeleteElasticIp : input . DeleteElasticIp } ) , ... ( input . DeleteVolumes !== undefined && input . DeleteVolumes !== null && { DeleteVolumes : input . DeleteVolumes } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1DeleteLayerRequest = ( input , context ) : any => { return { ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , } ; } ; const serializeAws_json1_1DeleteStackRequest = ( input , context ) : any => { return { ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DeleteUserProfileRequest = ( input , context ) : any => { return { ... ( input . IamUserArn !== undefined && input . IamUserArn !== null && { IamUserArn : input . IamUserArn } ) , } ; } ; const serializeAws_json1_1DeploymentCommand = ( input , context ) : any => { return { ... ( input . Args !== undefined && input . Args !== null && { Args : serializeAws_json1_1DeploymentCommandArgs ( input . Args , context ) } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1DeploymentCommandArgs = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_json1_1Strings ( value , context ) , } ; } , { } ) ; } ; const serializeAws_json1_1DeregisterEcsClusterRequest = ( input , context ) : any => { return { ... ( input . EcsClusterArn !== undefined && input . EcsClusterArn !== null && { EcsClusterArn : input . EcsClusterArn } ) , } ; } ; const serializeAws_json1_1DeregisterElasticIpRequest = ( input , context ) : any => { return { ... ( input . ElasticIp !== undefined && input . ElasticIp !== null && { ElasticIp : input . ElasticIp } ) , } ; } ; const serializeAws_json1_1DeregisterInstanceRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1DeregisterRdsDbInstanceRequest = ( input , context ) : any => { return { ... ( input . RdsDbInstanceArn !== undefined && input . RdsDbInstanceArn !== null && { RdsDbInstanceArn : input . RdsDbInstanceArn } ) , } ; } ; const serializeAws_json1_1DeregisterVolumeRequest = ( input , context ) : any => { return { ... ( input . VolumeId !== undefined && input . VolumeId !== null && { VolumeId : input . VolumeId } ) , } ; } ; const serializeAws_json1_1DescribeAgentVersionsRequest = ( input , context ) : any => { return { ... ( input . ConfigurationManager !== undefined && input . ConfigurationManager !== null && { ConfigurationManager : serializeAws_json1_1StackConfigurationManager ( input . ConfigurationManager , context ) , } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeAppsRequest = ( input , context ) : any => { return { ... ( input . AppIds !== undefined && input . AppIds !== null && { AppIds : serializeAws_json1_1Strings ( input . AppIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeCommandsRequest = ( input , context ) : any => { return { ... ( input . CommandIds !== undefined && input . CommandIds !== null && { CommandIds : serializeAws_json1_1Strings ( input . CommandIds , context ) } ) , ... ( input . DeploymentId !== undefined && input . DeploymentId !== null && { DeploymentId : input . DeploymentId } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1DescribeDeploymentsRequest = ( input , context ) : any => { return { ... ( input . AppId !== undefined && input . AppId !== null && { AppId : input . AppId } ) , ... ( input . DeploymentIds !== undefined && input . DeploymentIds !== null && { DeploymentIds : serializeAws_json1_1Strings ( input . DeploymentIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeEcsClustersRequest = ( input , context ) : any => { return { ... ( input . EcsClusterArns !== undefined && input . EcsClusterArns !== null && { EcsClusterArns : serializeAws_json1_1Strings ( input . EcsClusterArns , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeElasticIpsRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . Ips !== undefined && input . Ips !== null && { Ips : serializeAws_json1_1Strings ( input . Ips , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeElasticLoadBalancersRequest = ( input , context ) : any => { return { ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeInstancesRequest = ( input , context ) : any => { return { ... ( input . InstanceIds !== undefined && input . InstanceIds !== null && { InstanceIds : serializeAws_json1_1Strings ( input . InstanceIds , context ) } ) , ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeLayersRequest = ( input , context ) : any => { return { ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeLoadBasedAutoScalingRequest = ( input , context ) : any => { return { ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , } ; } ; const serializeAws_json1_1DescribePermissionsRequest = ( input , context ) : any => { return { ... ( input . IamUserArn !== undefined && input . IamUserArn !== null && { IamUserArn : input . IamUserArn } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeRaidArraysRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . RaidArrayIds !== undefined && input . RaidArrayIds !== null && { RaidArrayIds : serializeAws_json1_1Strings ( input . RaidArrayIds , context ) } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeRdsDbInstancesRequest = ( input , context ) : any => { return { ... ( input . RdsDbInstanceArns !== undefined && input . RdsDbInstanceArns !== null && { RdsDbInstanceArns : serializeAws_json1_1Strings ( input . RdsDbInstanceArns , context ) , } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeServiceErrorsRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . ServiceErrorIds !== undefined && input . ServiceErrorIds !== null && { ServiceErrorIds : serializeAws_json1_1Strings ( input . ServiceErrorIds , context ) , } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeStackProvisioningParametersRequest = ( input , context ) : any => { return { ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeStacksRequest = ( input , context ) : any => { return { ... ( input . StackIds !== undefined && input . StackIds !== null && { StackIds : serializeAws_json1_1Strings ( input . StackIds , context ) } ) , } ; } ; const serializeAws_json1_1DescribeStackSummaryRequest = ( input , context ) : any => { return { ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1DescribeTimeBasedAutoScalingRequest = ( input , context ) : any => { return { ... ( input . InstanceIds !== undefined && input . InstanceIds !== null && { InstanceIds : serializeAws_json1_1Strings ( input . InstanceIds , context ) } ) , } ; } ; const serializeAws_json1_1DescribeUserProfilesRequest = ( input , context ) : any => { return { ... ( input . IamUserArns !== undefined && input . IamUserArns !== null && { IamUserArns : serializeAws_json1_1Strings ( input . IamUserArns , context ) } ) , } ; } ; const serializeAws_json1_1DescribeVolumesRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . RaidArrayId !== undefined && input . RaidArrayId !== null && { RaidArrayId : input . RaidArrayId } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , ... ( input . VolumeIds !== undefined && input . VolumeIds !== null && { VolumeIds : serializeAws_json1_1Strings ( input . VolumeIds , context ) } ) , } ; } ; const serializeAws_json1_1DetachElasticLoadBalancerRequest = ( input , context ) : any => { return { ... ( input . ElasticLoadBalancerName !== undefined && input . ElasticLoadBalancerName !== null && { ElasticLoadBalancerName : input . ElasticLoadBalancerName } ) , ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , } ; } ; const serializeAws_json1_1DisassociateElasticIpRequest = ( input , context ) : any => { return { ... ( input . ElasticIp !== undefined && input . ElasticIp !== null && { ElasticIp : input . ElasticIp } ) , } ; } ; const serializeAws_json1_1EbsBlockDevice = ( input , context ) : any => { return { ... ( input . DeleteOnTermination !== undefined && input . DeleteOnTermination !== null && { DeleteOnTermination : input . DeleteOnTermination } ) , ... ( input . Iops !== undefined && input . Iops !== null && { Iops : input . Iops } ) , ... ( input . SnapshotId !== undefined && input . SnapshotId !== null && { SnapshotId : input . SnapshotId } ) , ... ( input . VolumeSize !== undefined && input . VolumeSize !== null && { VolumeSize : input . VolumeSize } ) , ... ( input . VolumeType !== undefined && input . VolumeType !== null && { VolumeType : input . VolumeType } ) , } ; } ; const serializeAws_json1_1EnvironmentVariable = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Secure !== undefined && input . Secure !== null && { Secure : input . Secure } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1EnvironmentVariables = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1EnvironmentVariable ( entry , context ) ; } ) ; } ; const serializeAws_json1_1GetHostnameSuggestionRequest = ( input , context ) : any => { return { ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , } ; } ; const serializeAws_json1_1GrantAccessRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . ValidForInMinutes !== undefined && input . ValidForInMinutes !== null && { ValidForInMinutes : input . ValidForInMinutes } ) , } ; } ; const serializeAws_json1_1InstanceIdentity = ( input , context ) : any => { return { ... ( input . Document !== undefined && input . Document !== null && { Document : input . Document } ) , ... ( input . Signature !== undefined && input . Signature !== null && { Signature : input . Signature } ) , } ; } ; const serializeAws_json1_1LayerAttributes = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1LifecycleEventConfiguration = ( input , context ) : any => { return { ... ( input . Shutdown !== undefined && input . Shutdown !== null && { Shutdown : serializeAws_json1_1ShutdownEventConfiguration ( input . Shutdown , context ) } ) , } ; } ; const serializeAws_json1_1ListTagsRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , } ; } ; const serializeAws_json1_1RebootInstanceRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1Recipes = ( input , context ) : any => { return { ... ( input . Configure !== undefined && input . Configure !== null && { Configure : serializeAws_json1_1Strings ( input . Configure , context ) } ) , ... ( input . Deploy !== undefined && input . Deploy !== null && { Deploy : serializeAws_json1_1Strings ( input . Deploy , context ) } ) , ... ( input . Setup !== undefined && input . Setup !== null && { Setup : serializeAws_json1_1Strings ( input . Setup , context ) } ) , ... ( input . Shutdown !== undefined && input . Shutdown !== null && { Shutdown : serializeAws_json1_1Strings ( input . Shutdown , context ) } ) , ... ( input . Undeploy !== undefined && input . Undeploy !== null && { Undeploy : serializeAws_json1_1Strings ( input . Undeploy , context ) } ) , } ; } ; const serializeAws_json1_1RegisterEcsClusterRequest = ( input , context ) : any => { return { ... ( input . EcsClusterArn !== undefined && input . EcsClusterArn !== null && { EcsClusterArn : input . EcsClusterArn } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1RegisterElasticIpRequest = ( input , context ) : any => { return { ... ( input . ElasticIp !== undefined && input . ElasticIp !== null && { ElasticIp : input . ElasticIp } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1RegisterInstanceRequest = ( input , context ) : any => { return { ... ( input . Hostname !== undefined && input . Hostname !== null && { Hostname : input . Hostname } ) , ... ( input . InstanceIdentity !== undefined && input . InstanceIdentity !== null && { InstanceIdentity : serializeAws_json1_1InstanceIdentity ( input . InstanceIdentity , context ) , } ) , ... ( input . PrivateIp !== undefined && input . PrivateIp !== null && { PrivateIp : input . PrivateIp } ) , ... ( input . PublicIp !== undefined && input . PublicIp !== null && { PublicIp : input . PublicIp } ) , ... ( input . RsaPublicKey !== undefined && input . RsaPublicKey !== null && { RsaPublicKey : input . RsaPublicKey } ) , ... ( input . RsaPublicKeyFingerprint !== undefined && input . RsaPublicKeyFingerprint !== null && { RsaPublicKeyFingerprint : input . RsaPublicKeyFingerprint } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1RegisterRdsDbInstanceRequest = ( input , context ) : any => { return { ... ( input . DbPassword !== undefined && input . DbPassword !== null && { DbPassword : input . DbPassword } ) , ... ( input . DbUser !== undefined && input . DbUser !== null && { DbUser : input . DbUser } ) , ... ( input . RdsDbInstanceArn !== undefined && input . RdsDbInstanceArn !== null && { RdsDbInstanceArn : input . RdsDbInstanceArn } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1RegisterVolumeRequest = ( input , context ) : any => { return { ... ( input . Ec2VolumeId !== undefined && input . Ec2VolumeId !== null && { Ec2VolumeId : input . Ec2VolumeId } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1SetLoadBasedAutoScalingRequest = ( input , context ) : any => { return { ... ( input . DownScaling !== undefined && input . DownScaling !== null && { DownScaling : serializeAws_json1_1AutoScalingThresholds ( input . DownScaling , context ) , } ) , ... ( input . Enable !== undefined && input . Enable !== null && { Enable : input . Enable } ) , ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , ... ( input . UpScaling !== undefined && input . UpScaling !== null && { UpScaling : serializeAws_json1_1AutoScalingThresholds ( input . UpScaling , context ) } ) , } ; } ; const serializeAws_json1_1SetPermissionRequest = ( input , context ) : any => { return { ... ( input . AllowSsh !== undefined && input . AllowSsh !== null && { AllowSsh : input . AllowSsh } ) , ... ( input . AllowSudo !== undefined && input . AllowSudo !== null && { AllowSudo : input . AllowSudo } ) , ... ( input . IamUserArn !== undefined && input . IamUserArn !== null && { IamUserArn : input . IamUserArn } ) , ... ( input . Level !== undefined && input . Level !== null && { Level : input . Level } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1SetTimeBasedAutoScalingRequest = ( input , context ) : any => { return { ... ( input . AutoScalingSchedule !== undefined && input . AutoScalingSchedule !== null && { AutoScalingSchedule : serializeAws_json1_1WeeklyAutoScalingSchedule ( input . AutoScalingSchedule , context ) , } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1ShutdownEventConfiguration = ( input , context ) : any => { return { ... ( input . DelayUntilElbConnectionsDrained !== undefined && input . DelayUntilElbConnectionsDrained !== null && { DelayUntilElbConnectionsDrained : input . DelayUntilElbConnectionsDrained , } ) , ... ( input . ExecutionTimeout !== undefined && input . ExecutionTimeout !== null && { ExecutionTimeout : input . ExecutionTimeout } ) , } ; } ; const serializeAws_json1_1Source = ( input , context ) : any => { return { ... ( input . Password !== undefined && input . Password !== null && { Password : input . Password } ) , ... ( input . Revision !== undefined && input . Revision !== null && { Revision : input . Revision } ) , ... ( input . SshKey !== undefined && input . SshKey !== null && { SshKey : input . SshKey } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , ... ( input . Username !== undefined && input . Username !== null && { Username : input . Username } ) , } ; } ; const serializeAws_json1_1SslConfiguration = ( input , context ) : any => { return { ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : input . Certificate } ) , ... ( input . Chain !== undefined && input . Chain !== null && { Chain : input . Chain } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : input . PrivateKey } ) , } ; } ; const serializeAws_json1_1StackAttributes = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1StackConfigurationManager = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Version !== undefined && input . Version !== null && { Version : input . Version } ) , } ; } ; const serializeAws_json1_1StartInstanceRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1StartStackRequest = ( input , context ) : any => { return { ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1StopInstanceRequest = ( input , context ) : any => { return { ... ( input . Force !== undefined && input . Force !== null && { Force : input . Force } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1StopStackRequest = ( input , context ) : any => { return { ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , } ; } ; const serializeAws_json1_1Strings = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TagKeys = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1Tags ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1Tags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1UnassignInstanceRequest = ( input , context ) : any => { return { ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , } ; } ; const serializeAws_json1_1UnassignVolumeRequest = ( input , context ) : any => { return { ... ( input . VolumeId !== undefined && input . VolumeId !== null && { VolumeId : input . VolumeId } ) , } ; } ; const serializeAws_json1_1UntagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . TagKeys !== undefined && input . TagKeys !== null && { TagKeys : serializeAws_json1_1TagKeys ( input . TagKeys , context ) } ) , } ; } ; const serializeAws_json1_1UpdateAppRequest = ( input , context ) : any => { return { ... ( input . AppId !== undefined && input . AppId !== null && { AppId : input . AppId } ) , ... ( input . AppSource !== undefined && input . AppSource !== null && { AppSource : serializeAws_json1_1Source ( input . AppSource , context ) } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1AppAttributes ( input . Attributes , context ) } ) , ... ( input . DataSources !== undefined && input . DataSources !== null && { DataSources : serializeAws_json1_1DataSources ( input . DataSources , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Domains !== undefined && input . Domains !== null && { Domains : serializeAws_json1_1Strings ( input . Domains , context ) } ) , ... ( input . EnableSsl !== undefined && input . EnableSsl !== null && { EnableSsl : input . EnableSsl } ) , ... ( input . Environment !== undefined && input . Environment !== null && { Environment : serializeAws_json1_1EnvironmentVariables ( input . Environment , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . SslConfiguration !== undefined && input . SslConfiguration !== null && { SslConfiguration : serializeAws_json1_1SslConfiguration ( input . SslConfiguration , context ) , } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_json1_1UpdateElasticIpRequest = ( input , context ) : any => { return { ... ( input . ElasticIp !== undefined && input . ElasticIp !== null && { ElasticIp : input . ElasticIp } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , } ; } ; const serializeAws_json1_1UpdateInstanceRequest = ( input , context ) : any => { return { ... ( input . AgentVersion !== undefined && input . AgentVersion !== null && { AgentVersion : input . AgentVersion } ) , ... ( input . AmiId !== undefined && input . AmiId !== null && { AmiId : input . AmiId } ) , ... ( input . Architecture !== undefined && input . Architecture !== null && { Architecture : input . Architecture } ) , ... ( input . AutoScalingType !== undefined && input . AutoScalingType !== null && { AutoScalingType : input . AutoScalingType } ) , ... ( input . EbsOptimized !== undefined && input . EbsOptimized !== null && { EbsOptimized : input . EbsOptimized } ) , ... ( input . Hostname !== undefined && input . Hostname !== null && { Hostname : input . Hostname } ) , ... ( input . InstallUpdatesOnBoot !== undefined && input . InstallUpdatesOnBoot !== null && { InstallUpdatesOnBoot : input . InstallUpdatesOnBoot } ) , ... ( input . InstanceId !== undefined && input . InstanceId !== null && { InstanceId : input . InstanceId } ) , ... ( input . InstanceType !== undefined && input . InstanceType !== null && { InstanceType : input . InstanceType } ) , ... ( input . LayerIds !== undefined && input . LayerIds !== null && { LayerIds : serializeAws_json1_1Strings ( input . LayerIds , context ) } ) , ... ( input . Os !== undefined && input . Os !== null && { Os : input . Os } ) , ... ( input . SshKeyName !== undefined && input . SshKeyName !== null && { SshKeyName : input . SshKeyName } ) , } ; } ; const serializeAws_json1_1UpdateLayerRequest = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1LayerAttributes ( input . Attributes , context ) } ) , ... ( input . AutoAssignElasticIps !== undefined && input . AutoAssignElasticIps !== null && { AutoAssignElasticIps : input . AutoAssignElasticIps } ) , ... ( input . AutoAssignPublicIps !== undefined && input . AutoAssignPublicIps !== null && { AutoAssignPublicIps : input . AutoAssignPublicIps } ) , ... ( input . CloudWatchLogsConfiguration !== undefined && input . CloudWatchLogsConfiguration !== null && { CloudWatchLogsConfiguration : serializeAws_json1_1CloudWatchLogsConfiguration ( input . CloudWatchLogsConfiguration , context ) , } ) , ... ( input . CustomInstanceProfileArn !== undefined && input . CustomInstanceProfileArn !== null && { CustomInstanceProfileArn : input . CustomInstanceProfileArn } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . CustomRecipes !== undefined && input . CustomRecipes !== null && { CustomRecipes : serializeAws_json1_1Recipes ( input . CustomRecipes , context ) } ) , ... ( input . CustomSecurityGroupIds !== undefined && input . CustomSecurityGroupIds !== null && { CustomSecurityGroupIds : serializeAws_json1_1Strings ( input . CustomSecurityGroupIds , context ) , } ) , ... ( input . EnableAutoHealing !== undefined && input . EnableAutoHealing !== null && { EnableAutoHealing : input . EnableAutoHealing } ) , ... ( input . InstallUpdatesOnBoot !== undefined && input . InstallUpdatesOnBoot !== null && { InstallUpdatesOnBoot : input . InstallUpdatesOnBoot } ) , ... ( input . LayerId !== undefined && input . LayerId !== null && { LayerId : input . LayerId } ) , ... ( input . LifecycleEventConfiguration !== undefined && input . LifecycleEventConfiguration !== null && { LifecycleEventConfiguration : serializeAws_json1_1LifecycleEventConfiguration ( input . LifecycleEventConfiguration , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Packages !== undefined && input . Packages !== null && { Packages : serializeAws_json1_1Strings ( input . Packages , context ) } ) , ... ( input . Shortname !== undefined && input . Shortname !== null && { Shortname : input . Shortname } ) , ... ( input . UseEbsOptimizedInstances !== undefined && input . UseEbsOptimizedInstances !== null && { UseEbsOptimizedInstances : input . UseEbsOptimizedInstances } ) , ... ( input . VolumeConfigurations !== undefined && input . VolumeConfigurations !== null && { VolumeConfigurations : serializeAws_json1_1VolumeConfigurations ( input . VolumeConfigurations , context ) , } ) , } ; } ; const serializeAws_json1_1UpdateMyUserProfileRequest = ( input , context ) : any => { return { ... ( input . SshPublicKey !== undefined && input . SshPublicKey !== null && { SshPublicKey : input . SshPublicKey } ) , } ; } ; const serializeAws_json1_1UpdateRdsDbInstanceRequest = ( input , context ) : any => { return { ... ( input . DbPassword !== undefined && input . DbPassword !== null && { DbPassword : input . DbPassword } ) , ... ( input . DbUser !== undefined && input . DbUser !== null && { DbUser : input . DbUser } ) , ... ( input . RdsDbInstanceArn !== undefined && input . RdsDbInstanceArn !== null && { RdsDbInstanceArn : input . RdsDbInstanceArn } ) , } ; } ; const serializeAws_json1_1UpdateStackRequest = ( input , context ) : any => { return { ... ( input . AgentVersion !== undefined && input . AgentVersion !== null && { AgentVersion : input . AgentVersion } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_json1_1StackAttributes ( input . Attributes , context ) } ) , ... ( input . ChefConfiguration !== undefined && input . ChefConfiguration !== null && { ChefConfiguration : serializeAws_json1_1ChefConfiguration ( input . ChefConfiguration , context ) , } ) , ... ( input . ConfigurationManager !== undefined && input . ConfigurationManager !== null && { ConfigurationManager : serializeAws_json1_1StackConfigurationManager ( input . ConfigurationManager , context ) , } ) , ... ( input . CustomCookbooksSource !== undefined && input . CustomCookbooksSource !== null && { CustomCookbooksSource : serializeAws_json1_1Source ( input . CustomCookbooksSource , context ) , } ) , ... ( input . CustomJson !== undefined && input . CustomJson !== null && { CustomJson : input . CustomJson } ) , ... ( input . DefaultAvailabilityZone !== undefined && input . DefaultAvailabilityZone !== null && { DefaultAvailabilityZone : input . DefaultAvailabilityZone } ) , ... ( input . DefaultInstanceProfileArn !== undefined && input . DefaultInstanceProfileArn !== null && { DefaultInstanceProfileArn : input . DefaultInstanceProfileArn } ) , ... ( input . DefaultOs !== undefined && input . DefaultOs !== null && { DefaultOs : input . DefaultOs } ) , ... ( input . DefaultRootDeviceType !== undefined && input . DefaultRootDeviceType !== null && { DefaultRootDeviceType : input . DefaultRootDeviceType } ) , ... ( input . DefaultSshKeyName !== undefined && input . DefaultSshKeyName !== null && { DefaultSshKeyName : input . DefaultSshKeyName } ) , ... ( input . DefaultSubnetId !== undefined && input . DefaultSubnetId !== null && { DefaultSubnetId : input . DefaultSubnetId } ) , ... ( input . HostnameTheme !== undefined && input . HostnameTheme !== null && { HostnameTheme : input . HostnameTheme } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . ServiceRoleArn !== undefined && input . ServiceRoleArn !== null && { ServiceRoleArn : input . ServiceRoleArn } ) , ... ( input . StackId !== undefined && input . StackId !== null && { StackId : input . StackId } ) , ... ( input . UseCustomCookbooks !== undefined && input . UseCustomCookbooks !== null && { UseCustomCookbooks : input . UseCustomCookbooks } ) , ... ( input . UseOpsworksSecurityGroups !== undefined && input . UseOpsworksSecurityGroups !== null && { UseOpsworksSecurityGroups : input . UseOpsworksSecurityGroups } ) , } ; } ; const serializeAws_json1_1UpdateUserProfileRequest = ( input , context ) : any => { return { ... ( input . AllowSelfManagement !== undefined && input . AllowSelfManagement !== null && { AllowSelfManagement : input . AllowSelfManagement } ) , ... ( input . IamUserArn !== undefined && input . IamUserArn !== null && { IamUserArn : input . IamUserArn } ) , ... ( input . SshPublicKey !== undefined && input . SshPublicKey !== null && { SshPublicKey : input . SshPublicKey } ) , ... ( input . SshUsername !== undefined && input . SshUsername !== null && { SshUsername : input . SshUsername } ) , } ; } ; const serializeAws_json1_1UpdateVolumeRequest = ( input , context ) : any => { return { ... ( input . MountPoint !== undefined && input . MountPoint !== null && { MountPoint : input . MountPoint } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . VolumeId !== undefined && input . VolumeId !== null && { VolumeId : input . VolumeId } ) , } ; } ; const serializeAws_json1_1VolumeConfiguration = ( input , context ) : any => { return { ... ( input . Encrypted !== undefined && input . Encrypted !== null && { Encrypted : input . Encrypted } ) , ... ( input . Iops !== undefined && input . Iops !== null && { Iops : input . Iops } ) , ... ( input . MountPoint !== undefined && input . MountPoint !== null && { MountPoint : input . MountPoint } ) , ... ( input . NumberOfDisks !== undefined && input . NumberOfDisks !== null && { NumberOfDisks : input . NumberOfDisks } ) , ... ( input . RaidLevel !== undefined && input . RaidLevel !== null && { RaidLevel : input . RaidLevel } ) , ... ( input . Size !== undefined && input . Size !== null && { Size : input . Size } ) , ... ( input . VolumeType !== undefined && input . VolumeType !== null && { VolumeType : input . VolumeType } ) , } ; } ; const serializeAws_json1_1VolumeConfigurations = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1VolumeConfiguration ( entry , context ) ; } ) ; } ; const serializeAws_json1_1WeeklyAutoScalingSchedule = ( input , context ) : any => { return { ... ( input . Friday !== undefined && input . Friday !== null && { Friday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Friday , context ) } ) , ... ( input . Monday !== undefined && input . Monday !== null && { Monday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Monday , context ) } ) , ... ( input . Saturday !== undefined && input . Saturday !== null && { Saturday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Saturday , context ) } ) , ... ( input . Sunday !== undefined && input . Sunday !== null && { Sunday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Sunday , context ) } ) , ... ( input . Thursday !== undefined && input . Thursday !== null && { Thursday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Thursday , context ) } ) , ... ( input . Tuesday !== undefined && input . Tuesday !== null && { Tuesday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Tuesday , context ) } ) , ... ( input . Wednesday !== undefined && input . Wednesday !== null && { Wednesday : serializeAws_json1_1DailyAutoScalingSchedule ( input . Wednesday , context ) , } ) , } ; } ; const deserializeAws_json1_1AgentVersion = ( output , context ) : AgentVersion => { return { ConfigurationManager : output . ConfigurationManager !== undefined && output . ConfigurationManager !== null ? deserializeAws_json1_1StackConfigurationManager ( output . ConfigurationManager , context ) : undefined , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_json1_1AgentVersions = ( output , context ) : AgentVersion [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1AgentVersion ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1App = ( output , context ) : App => { return { AppId : __expectString ( output . AppId ) , AppSource : output . AppSource !== undefined && output . AppSource !== null ? deserializeAws_json1_1Source ( output . AppSource , context ) : undefined , Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1AppAttributes ( output . Attributes , context ) : undefined , CreatedAt : __expectString ( output . CreatedAt ) , DataSources : output . DataSources !== undefined && output . DataSources !== null ? deserializeAws_json1_1DataSources ( output . DataSources , context ) : undefined , Description : __expectString ( output . Description ) , Domains : output . Domains !== undefined && output . Domains !== null ? deserializeAws_json1_1Strings ( output . Domains , context ) : undefined , EnableSsl : __expectBoolean ( output . EnableSsl ) , Environment : output . Environment !== undefined && output . Environment !== null ? deserializeAws_json1_1EnvironmentVariables ( output . Environment , context ) : undefined , Name : __expectString ( output . Name ) , Shortname : __expectString ( output . Shortname ) , SslConfiguration : output . SslConfiguration !== undefined && output . SslConfiguration !== null ? deserializeAws_json1_1SslConfiguration ( output . SslConfiguration , context ) : undefined , StackId : __expectString ( output . StackId ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1AppAttributes = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1Apps = ( output , context ) : App [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1App ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1AutoScalingThresholds = ( output , context ) : AutoScalingThresholds => { return { Alarms : output . Alarms !== undefined && output . Alarms !== null ? deserializeAws_json1_1Strings ( output . Alarms , context ) : undefined , CpuThreshold : __limitedParseDouble ( output . CpuThreshold ) , IgnoreMetricsTime : __expectInt32 ( output . IgnoreMetricsTime ) , InstanceCount : __expectInt32 ( output . InstanceCount ) , LoadThreshold : __limitedParseDouble ( output . LoadThreshold ) , MemoryThreshold : __limitedParseDouble ( output . MemoryThreshold ) , ThresholdsWaitTime : __expectInt32 ( output . ThresholdsWaitTime ) , } as any ; } ; const deserializeAws_json1_1BlockDeviceMapping = ( output , context ) : BlockDeviceMapping => { return { DeviceName : __expectString ( output . DeviceName ) , Ebs : output . Ebs !== undefined && output . Ebs !== null ? deserializeAws_json1_1EbsBlockDevice ( output . Ebs , context ) : undefined , NoDevice : __expectString ( output . NoDevice ) , VirtualName : __expectString ( output . VirtualName ) , } as any ; } ; const deserializeAws_json1_1BlockDeviceMappings = ( output , context ) : BlockDeviceMapping [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BlockDeviceMapping ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ChefConfiguration = ( output , context ) : ChefConfiguration => { return { BerkshelfVersion : __expectString ( output . BerkshelfVersion ) , ManageBerkshelf : __expectBoolean ( output . ManageBerkshelf ) , } as any ; } ; const deserializeAws_json1_1CloneStackResult = ( output , context ) : CloneStackResult => { return { StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1CloudWatchLogsConfiguration = ( output , context ) : CloudWatchLogsConfiguration => { return { Enabled : __expectBoolean ( output . Enabled ) , LogStreams : output . LogStreams !== undefined && output . LogStreams !== null ? deserializeAws_json1_1CloudWatchLogsLogStreams ( output . LogStreams , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CloudWatchLogsLogStream = ( output , context ) : CloudWatchLogsLogStream => { return { BatchCount : __expectInt32 ( output . BatchCount ) , BatchSize : __expectInt32 ( output . BatchSize ) , BufferDuration : __expectInt32 ( output . BufferDuration ) , DatetimeFormat : __expectString ( output . DatetimeFormat ) , Encoding : __expectString ( output . Encoding ) , File : __expectString ( output . File ) , FileFingerprintLines : __expectString ( output . FileFingerprintLines ) , InitialPosition : __expectString ( output . InitialPosition ) , LogGroupName : __expectString ( output . LogGroupName ) , MultiLineStartPattern : __expectString ( output . MultiLineStartPattern ) , TimeZone : __expectString ( output . TimeZone ) , } as any ; } ; const deserializeAws_json1_1CloudWatchLogsLogStreams = ( output , context ) : CloudWatchLogsLogStream [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1CloudWatchLogsLogStream ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Command = ( output , context ) : Command => { return { AcknowledgedAt : __expectString ( output . AcknowledgedAt ) , CommandId : __expectString ( output . CommandId ) , CompletedAt : __expectString ( output . CompletedAt ) , CreatedAt : __expectString ( output . CreatedAt ) , DeploymentId : __expectString ( output . DeploymentId ) , ExitCode : __expectInt32 ( output . ExitCode ) , InstanceId : __expectString ( output . InstanceId ) , LogUrl : __expectString ( output . LogUrl ) , Status : __expectString ( output . Status ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1Commands = ( output , context ) : Command [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Command ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1CreateAppResult = ( output , context ) : CreateAppResult => { return { AppId : __expectString ( output . AppId ) , } as any ; } ; const deserializeAws_json1_1CreateDeploymentResult = ( output , context ) : CreateDeploymentResult => { return { DeploymentId : __expectString ( output . DeploymentId ) , } as any ; } ; const deserializeAws_json1_1CreateInstanceResult = ( output , context ) : CreateInstanceResult => { return { InstanceId : __expectString ( output . InstanceId ) , } as any ; } ; const deserializeAws_json1_1CreateLayerResult = ( output , context ) : CreateLayerResult => { return { LayerId : __expectString ( output . LayerId ) , } as any ; } ; const deserializeAws_json1_1CreateStackResult = ( output , context ) : CreateStackResult => { return { StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1CreateUserProfileResult = ( output , context ) : CreateUserProfileResult => { return { IamUserArn : __expectString ( output . IamUserArn ) , } as any ; } ; const deserializeAws_json1_1DailyAutoScalingSchedule = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1DataSource = ( output , context ) : DataSource => { return { Arn : __expectString ( output . Arn ) , DatabaseName : __expectString ( output . DatabaseName ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1DataSources = ( output , context ) : DataSource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1DataSource ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Deployment = ( output , context ) : Deployment => { return { AppId : __expectString ( output . AppId ) , Command : output . Command !== undefined && output . Command !== null ? deserializeAws_json1_1DeploymentCommand ( output . Command , context ) : undefined , Comment : __expectString ( output . Comment ) , CompletedAt : __expectString ( output . CompletedAt ) , CreatedAt : __expectString ( output . CreatedAt ) , CustomJson : __expectString ( output . CustomJson ) , DeploymentId : __expectString ( output . DeploymentId ) , Duration : __expectInt32 ( output . Duration ) , IamUserArn : __expectString ( output . IamUserArn ) , InstanceIds : output . InstanceIds !== undefined && output . InstanceIds !== null ? deserializeAws_json1_1Strings ( output . InstanceIds , context ) : undefined , StackId : __expectString ( output . StackId ) , Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_json1_1DeploymentCommand = ( output , context ) : DeploymentCommand => { return { Args : output . Args !== undefined && output . Args !== null ? deserializeAws_json1_1DeploymentCommandArgs ( output . Args , context ) : undefined , Name : __expectString ( output . Name ) , } as any ; } ; const deserializeAws_json1_1DeploymentCommandArgs = ( output , context ) : { [ key ] : string [ ] ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_json1_1Strings ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_json1_1Deployments = ( output , context ) : Deployment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Deployment ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DescribeAgentVersionsResult = ( output , context ) : DescribeAgentVersionsResult => { return { AgentVersions : output . AgentVersions !== undefined && output . AgentVersions !== null ? deserializeAws_json1_1AgentVersions ( output . AgentVersions , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeAppsResult = ( output , context ) : DescribeAppsResult => { return { Apps : output . Apps !== undefined && output . Apps !== null ? deserializeAws_json1_1Apps ( output . Apps , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeCommandsResult = ( output , context ) : DescribeCommandsResult => { return { Commands : output . Commands !== undefined && output . Commands !== null ? deserializeAws_json1_1Commands ( output . Commands , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeDeploymentsResult = ( output , context ) : DescribeDeploymentsResult => { return { Deployments : output . Deployments !== undefined && output . Deployments !== null ? deserializeAws_json1_1Deployments ( output . Deployments , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEcsClustersResult = ( output , context ) : DescribeEcsClustersResult => { return { EcsClusters : output . EcsClusters !== undefined && output . EcsClusters !== null ? deserializeAws_json1_1EcsClusters ( output . EcsClusters , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1DescribeElasticIpsResult = ( output , context ) : DescribeElasticIpsResult => { return { ElasticIps : output . ElasticIps !== undefined && output . ElasticIps !== null ? deserializeAws_json1_1ElasticIps ( output . ElasticIps , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeElasticLoadBalancersResult = ( output , context ) : DescribeElasticLoadBalancersResult => { return { ElasticLoadBalancers : output . ElasticLoadBalancers !== undefined && output . ElasticLoadBalancers !== null ? deserializeAws_json1_1ElasticLoadBalancers ( output . ElasticLoadBalancers , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeInstancesResult = ( output , context ) : DescribeInstancesResult => { return { Instances : output . Instances !== undefined && output . Instances !== null ? deserializeAws_json1_1Instances ( output . Instances , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeLayersResult = ( output , context ) : DescribeLayersResult => { return { Layers : output . Layers !== undefined && output . Layers !== null ? deserializeAws_json1_1Layers ( output . Layers , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeLoadBasedAutoScalingResult = ( output , context ) : DescribeLoadBasedAutoScalingResult => { return { LoadBasedAutoScalingConfigurations : output . LoadBasedAutoScalingConfigurations !== undefined && output . LoadBasedAutoScalingConfigurations !== null ? deserializeAws_json1_1LoadBasedAutoScalingConfigurations ( output . LoadBasedAutoScalingConfigurations , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeMyUserProfileResult = ( output , context ) : DescribeMyUserProfileResult => { return { UserProfile : output . UserProfile !== undefined && output . UserProfile !== null ? deserializeAws_json1_1SelfUserProfile ( output . UserProfile , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeOperatingSystemsResponse = ( output , context ) : DescribeOperatingSystemsResponse => { return { OperatingSystems : output . OperatingSystems !== undefined && output . OperatingSystems !== null ? deserializeAws_json1_1OperatingSystems ( output . OperatingSystems , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribePermissionsResult = ( output , context ) : DescribePermissionsResult => { return { Permissions : output . Permissions !== undefined && output . Permissions !== null ? deserializeAws_json1_1Permissions ( output . Permissions , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeRaidArraysResult = ( output , context ) : DescribeRaidArraysResult => { return { RaidArrays : output . RaidArrays !== undefined && output . RaidArrays !== null ? deserializeAws_json1_1RaidArrays ( output . RaidArrays , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeRdsDbInstancesResult = ( output , context ) : DescribeRdsDbInstancesResult => { return { RdsDbInstances : output . RdsDbInstances !== undefined && output . RdsDbInstances !== null ? deserializeAws_json1_1RdsDbInstances ( output . RdsDbInstances , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeServiceErrorsResult = ( output , context ) : DescribeServiceErrorsResult => { return { ServiceErrors : output . ServiceErrors !== undefined && output . ServiceErrors !== null ? deserializeAws_json1_1ServiceErrors ( output . ServiceErrors , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeStackProvisioningParametersResult = ( output , context ) : DescribeStackProvisioningParametersResult => { return { AgentInstallerUrl : __expectString ( output . AgentInstallerUrl ) , Parameters : output . Parameters !== undefined && output . Parameters !== null ? deserializeAws_json1_1Parameters ( output . Parameters , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeStacksResult = ( output , context ) : DescribeStacksResult => { return { Stacks : output . Stacks !== undefined && output . Stacks !== null ? deserializeAws_json1_1Stacks ( output . Stacks , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeStackSummaryResult = ( output , context ) : DescribeStackSummaryResult => { return { StackSummary : output . StackSummary !== undefined && output . StackSummary !== null ? deserializeAws_json1_1StackSummary ( output . StackSummary , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeTimeBasedAutoScalingResult = ( output , context ) : DescribeTimeBasedAutoScalingResult => { return { TimeBasedAutoScalingConfigurations : output . TimeBasedAutoScalingConfigurations !== undefined && output . TimeBasedAutoScalingConfigurations !== null ? deserializeAws_json1_1TimeBasedAutoScalingConfigurations ( output . TimeBasedAutoScalingConfigurations , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeUserProfilesResult = ( output , context ) : DescribeUserProfilesResult => { return { UserProfiles : output . UserProfiles !== undefined && output . UserProfiles !== null ? deserializeAws_json1_1UserProfiles ( output . UserProfiles , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeVolumesResult = ( output , context ) : DescribeVolumesResult => { return { Volumes : output . Volumes !== undefined && output . Volumes !== null ? deserializeAws_json1_1Volumes ( output . Volumes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1EbsBlockDevice = ( output , context ) : EbsBlockDevice => { return { DeleteOnTermination : __expectBoolean ( output . DeleteOnTermination ) , Iops : __expectInt32 ( output . Iops ) , SnapshotId : __expectString ( output . SnapshotId ) , VolumeSize : __expectInt32 ( output . VolumeSize ) , VolumeType : __expectString ( output . VolumeType ) , } as any ; } ; const deserializeAws_json1_1EcsCluster = ( output , context ) : EcsCluster => { return { EcsClusterArn : __expectString ( output . EcsClusterArn ) , EcsClusterName : __expectString ( output . EcsClusterName ) , RegisteredAt : __expectString ( output . RegisteredAt ) , StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1EcsClusters = ( output , context ) : EcsCluster [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EcsCluster ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ElasticIp = ( output , context ) : ElasticIp => { return { Domain : __expectString ( output . Domain ) , InstanceId : __expectString ( output . InstanceId ) , Ip : __expectString ( output . Ip ) , Name : __expectString ( output . Name ) , Region : __expectString ( output . Region ) , } as any ; } ; const deserializeAws_json1_1ElasticIps = ( output , context ) : ElasticIp [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ElasticIp ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ElasticLoadBalancer = ( output , context ) : ElasticLoadBalancer => { return { AvailabilityZones : output . AvailabilityZones !== undefined && output . AvailabilityZones !== null ? deserializeAws_json1_1Strings ( output . AvailabilityZones , context ) : undefined , DnsName : __expectString ( output . DnsName ) , Ec2InstanceIds : output . Ec2InstanceIds !== undefined && output . Ec2InstanceIds !== null ? deserializeAws_json1_1Strings ( output . Ec2InstanceIds , context ) : undefined , ElasticLoadBalancerName : __expectString ( output . ElasticLoadBalancerName ) , LayerId : __expectString ( output . LayerId ) , Region : __expectString ( output . Region ) , StackId : __expectString ( output . StackId ) , SubnetIds : output . SubnetIds !== undefined && output . SubnetIds !== null ? deserializeAws_json1_1Strings ( output . SubnetIds , context ) : undefined , VpcId : __expectString ( output . VpcId ) , } as any ; } ; const deserializeAws_json1_1ElasticLoadBalancers = ( output , context ) : ElasticLoadBalancer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ElasticLoadBalancer ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EnvironmentVariable = ( output , context ) : EnvironmentVariable => { return { Key : __expectString ( output . Key ) , Secure : __expectBoolean ( output . Secure ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1EnvironmentVariables = ( output , context ) : EnvironmentVariable [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EnvironmentVariable ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1GetHostnameSuggestionResult = ( output , context ) : GetHostnameSuggestionResult => { return { Hostname : __expectString ( output . Hostname ) , LayerId : __expectString ( output . LayerId ) , } as any ; } ; const deserializeAws_json1_1GrantAccessResult = ( output , context ) : GrantAccessResult => { return { TemporaryCredential : output . TemporaryCredential !== undefined && output . TemporaryCredential !== null ? deserializeAws_json1_1TemporaryCredential ( output . TemporaryCredential , context ) : undefined , } as any ; } ; const deserializeAws_json1_1Instance = ( output , context ) : Instance => { return { AgentVersion : __expectString ( output . AgentVersion ) , AmiId : __expectString ( output . AmiId ) , Architecture : __expectString ( output . Architecture ) , Arn : __expectString ( output . Arn ) , AutoScalingType : __expectString ( output . AutoScalingType ) , AvailabilityZone : __expectString ( output . AvailabilityZone ) , BlockDeviceMappings : output . BlockDeviceMappings !== undefined && output . BlockDeviceMappings !== null ? deserializeAws_json1_1BlockDeviceMappings ( output . BlockDeviceMappings , context ) : undefined , CreatedAt : __expectString ( output . CreatedAt ) , EbsOptimized : __expectBoolean ( output . EbsOptimized ) , Ec2InstanceId : __expectString ( output . Ec2InstanceId ) , EcsClusterArn : __expectString ( output . EcsClusterArn ) , EcsContainerInstanceArn : __expectString ( output . EcsContainerInstanceArn ) , ElasticIp : __expectString ( output . ElasticIp ) , Hostname : __expectString ( output . Hostname ) , InfrastructureClass : __expectString ( output . InfrastructureClass ) , InstallUpdatesOnBoot : __expectBoolean ( output . InstallUpdatesOnBoot ) , InstanceId : __expectString ( output . InstanceId ) , InstanceProfileArn : __expectString ( output . InstanceProfileArn ) , InstanceType : __expectString ( output . InstanceType ) , LastServiceErrorId : __expectString ( output . LastServiceErrorId ) , LayerIds : output . LayerIds !== undefined && output . LayerIds !== null ? deserializeAws_json1_1Strings ( output . LayerIds , context ) : undefined , Os : __expectString ( output . Os ) , Platform : __expectString ( output . Platform ) , PrivateDns : __expectString ( output . PrivateDns ) , PrivateIp : __expectString ( output . PrivateIp ) , PublicDns : __expectString ( output . PublicDns ) , PublicIp : __expectString ( output . PublicIp ) , RegisteredBy : __expectString ( output . RegisteredBy ) , ReportedAgentVersion : __expectString ( output . ReportedAgentVersion ) , ReportedOs : output . ReportedOs !== undefined && output . ReportedOs !== null ? deserializeAws_json1_1ReportedOs ( output . ReportedOs , context ) : undefined , RootDeviceType : __expectString ( output . RootDeviceType ) , RootDeviceVolumeId : __expectString ( output . RootDeviceVolumeId ) , SecurityGroupIds : output . SecurityGroupIds !== undefined && output . SecurityGroupIds !== null ? deserializeAws_json1_1Strings ( output . SecurityGroupIds , context ) : undefined , SshHostDsaKeyFingerprint : __expectString ( output . SshHostDsaKeyFingerprint ) , SshHostRsaKeyFingerprint : __expectString ( output . SshHostRsaKeyFingerprint ) , SshKeyName : __expectString ( output . SshKeyName ) , StackId : __expectString ( output . StackId ) , Status : __expectString ( output . Status ) , SubnetId : __expectString ( output . SubnetId ) , Tenancy : __expectString ( output . Tenancy ) , VirtualizationType : __expectString ( output . VirtualizationType ) , } as any ; } ; const deserializeAws_json1_1Instances = ( output , context ) : Instance [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Instance ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1InstancesCount = ( output , context ) : InstancesCount => { return { Assigning : __expectInt32 ( output . Assigning ) , Booting : __expectInt32 ( output . Booting ) , ConnectionLost : __expectInt32 ( output . ConnectionLost ) , Deregistering : __expectInt32 ( output . Deregistering ) , Online : __expectInt32 ( output . Online ) , Pending : __expectInt32 ( output . Pending ) , Rebooting : __expectInt32 ( output . Rebooting ) , Registered : __expectInt32 ( output . Registered ) , Registering : __expectInt32 ( output . Registering ) , Requested : __expectInt32 ( output . Requested ) , RunningSetup : __expectInt32 ( output . RunningSetup ) , SetupFailed : __expectInt32 ( output . SetupFailed ) , ShuttingDown : __expectInt32 ( output . ShuttingDown ) , StartFailed : __expectInt32 ( output . StartFailed ) , StopFailed : __expectInt32 ( output . StopFailed ) , Stopped : __expectInt32 ( output . Stopped ) , Stopping : __expectInt32 ( output . Stopping ) , Terminated : __expectInt32 ( output . Terminated ) , Terminating : __expectInt32 ( output . Terminating ) , Unassigning : __expectInt32 ( output . Unassigning ) , } as any ; } ; const deserializeAws_json1_1Layer = ( output , context ) : Layer => { return { Arn : __expectString ( output . Arn ) , Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1LayerAttributes ( output . Attributes , context ) : undefined , AutoAssignElasticIps : __expectBoolean ( output . AutoAssignElasticIps ) , AutoAssignPublicIps : __expectBoolean ( output . AutoAssignPublicIps ) , CloudWatchLogsConfiguration : output . CloudWatchLogsConfiguration !== undefined && output . CloudWatchLogsConfiguration !== null ? deserializeAws_json1_1CloudWatchLogsConfiguration ( output . CloudWatchLogsConfiguration , context ) : undefined , CreatedAt : __expectString ( output . CreatedAt ) , CustomInstanceProfileArn : __expectString ( output . CustomInstanceProfileArn ) , CustomJson : __expectString ( output . CustomJson ) , CustomRecipes : output . CustomRecipes !== undefined && output . CustomRecipes !== null ? deserializeAws_json1_1Recipes ( output . CustomRecipes , context ) : undefined , CustomSecurityGroupIds : output . CustomSecurityGroupIds !== undefined && output . CustomSecurityGroupIds !== null ? deserializeAws_json1_1Strings ( output . CustomSecurityGroupIds , context ) : undefined , DefaultRecipes : output . DefaultRecipes !== undefined && output . DefaultRecipes !== null ? deserializeAws_json1_1Recipes ( output . DefaultRecipes , context ) : undefined , DefaultSecurityGroupNames : output . DefaultSecurityGroupNames !== undefined && output . DefaultSecurityGroupNames !== null ? deserializeAws_json1_1Strings ( output . DefaultSecurityGroupNames , context ) : undefined , EnableAutoHealing : __expectBoolean ( output . EnableAutoHealing ) , InstallUpdatesOnBoot : __expectBoolean ( output . InstallUpdatesOnBoot ) , LayerId : __expectString ( output . LayerId ) , LifecycleEventConfiguration : output . LifecycleEventConfiguration !== undefined && output . LifecycleEventConfiguration !== null ? deserializeAws_json1_1LifecycleEventConfiguration ( output . LifecycleEventConfiguration , context ) : undefined , Name : __expectString ( output . Name ) , Packages : output . Packages !== undefined && output . Packages !== null ? deserializeAws_json1_1Strings ( output . Packages , context ) : undefined , Shortname : __expectString ( output . Shortname ) , StackId : __expectString ( output . StackId ) , Type : __expectString ( output . Type ) , UseEbsOptimizedInstances : __expectBoolean ( output . UseEbsOptimizedInstances ) , VolumeConfigurations : output . VolumeConfigurations !== undefined && output . VolumeConfigurations !== null ? deserializeAws_json1_1VolumeConfigurations ( output . VolumeConfigurations , context ) : undefined , } as any ; } ; const deserializeAws_json1_1LayerAttributes = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1Layers = ( output , context ) : Layer [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Layer ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1LifecycleEventConfiguration = ( output , context ) : LifecycleEventConfiguration => { return { Shutdown : output . Shutdown !== undefined && output . Shutdown !== null ? deserializeAws_json1_1ShutdownEventConfiguration ( output . Shutdown , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListTagsResult = ( output , context ) : ListTagsResult => { return { NextToken : __expectString ( output . NextToken ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_json1_1Tags ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1LoadBasedAutoScalingConfiguration = ( output , context ) : LoadBasedAutoScalingConfiguration => { return { DownScaling : output . DownScaling !== undefined && output . DownScaling !== null ? deserializeAws_json1_1AutoScalingThresholds ( output . DownScaling , context ) : undefined , Enable : __expectBoolean ( output . Enable ) , LayerId : __expectString ( output . LayerId ) , UpScaling : output . UpScaling !== undefined && output . UpScaling !== null ? deserializeAws_json1_1AutoScalingThresholds ( output . UpScaling , context ) : undefined , } as any ; } ; const deserializeAws_json1_1LoadBasedAutoScalingConfigurations = ( output , context ) : LoadBasedAutoScalingConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1LoadBasedAutoScalingConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1OperatingSystem = ( output , context ) : OperatingSystem => { return { ConfigurationManagers : output . ConfigurationManagers !== undefined && output . ConfigurationManagers !== null ? deserializeAws_json1_1OperatingSystemConfigurationManagers ( output . ConfigurationManagers , context ) : undefined , Id : __expectString ( output . Id ) , Name : __expectString ( output . Name ) , ReportedName : __expectString ( output . ReportedName ) , ReportedVersion : __expectString ( output . ReportedVersion ) , Supported : __expectBoolean ( output . Supported ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1OperatingSystemConfigurationManager = ( output , context ) : OperatingSystemConfigurationManager => { return { Name : __expectString ( output . Name ) , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_json1_1OperatingSystemConfigurationManagers = ( output , context ) : OperatingSystemConfigurationManager [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1OperatingSystemConfigurationManager ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1OperatingSystems = ( output , context ) : OperatingSystem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1OperatingSystem ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Parameters = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1Permission = ( output , context ) : Permission => { return { AllowSsh : __expectBoolean ( output . AllowSsh ) , AllowSudo : __expectBoolean ( output . AllowSudo ) , IamUserArn : __expectString ( output . IamUserArn ) , Level : __expectString ( output . Level ) , StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1Permissions = ( output , context ) : Permission [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Permission ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RaidArray = ( output , context ) : RaidArray => { return { AvailabilityZone : __expectString ( output . AvailabilityZone ) , CreatedAt : __expectString ( output . CreatedAt ) , Device : __expectString ( output . Device ) , InstanceId : __expectString ( output . InstanceId ) , Iops : __expectInt32 ( output . Iops ) , MountPoint : __expectString ( output . MountPoint ) , Name : __expectString ( output . Name ) , NumberOfDisks : __expectInt32 ( output . NumberOfDisks ) , RaidArrayId : __expectString ( output . RaidArrayId ) , RaidLevel : __expectInt32 ( output . RaidLevel ) , Size : __expectInt32 ( output . Size ) , StackId : __expectString ( output . StackId ) , VolumeType : __expectString ( output . VolumeType ) , } as any ; } ; const deserializeAws_json1_1RaidArrays = ( output , context ) : RaidArray [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RaidArray ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RdsDbInstance = ( output , context ) : RdsDbInstance => { return { Address : __expectString ( output . Address ) , DbInstanceIdentifier : __expectString ( output . DbInstanceIdentifier ) , DbPassword : __expectString ( output . DbPassword ) , DbUser : __expectString ( output . DbUser ) , Engine : __expectString ( output . Engine ) , MissingOnRds : __expectBoolean ( output . MissingOnRds ) , RdsDbInstanceArn : __expectString ( output . RdsDbInstanceArn ) , Region : __expectString ( output . Region ) , StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1RdsDbInstances = ( output , context ) : RdsDbInstance [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RdsDbInstance ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Recipes = ( output , context ) : Recipes => { return { Configure : output . Configure !== undefined && output . Configure !== null ? deserializeAws_json1_1Strings ( output . Configure , context ) : undefined , Deploy : output . Deploy !== undefined && output . Deploy !== null ? deserializeAws_json1_1Strings ( output . Deploy , context ) : undefined , Setup : output . Setup !== undefined && output . Setup !== null ? deserializeAws_json1_1Strings ( output . Setup , context ) : undefined , Shutdown : output . Shutdown !== undefined && output . Shutdown !== null ? deserializeAws_json1_1Strings ( output . Shutdown , context ) : undefined , Undeploy : output . Undeploy !== undefined && output . Undeploy !== null ? deserializeAws_json1_1Strings ( output . Undeploy , context ) : undefined , } as any ; } ; const deserializeAws_json1_1RegisterEcsClusterResult = ( output , context ) : RegisterEcsClusterResult => { return { EcsClusterArn : __expectString ( output . EcsClusterArn ) , } as any ; } ; const deserializeAws_json1_1RegisterElasticIpResult = ( output , context ) : RegisterElasticIpResult => { return { ElasticIp : __expectString ( output . ElasticIp ) , } as any ; } ; const deserializeAws_json1_1RegisterInstanceResult = ( output , context ) : RegisterInstanceResult => { return { InstanceId : __expectString ( output . InstanceId ) , } as any ; } ; const deserializeAws_json1_1RegisterVolumeResult = ( output , context ) : RegisterVolumeResult => { return { VolumeId : __expectString ( output . VolumeId ) , } as any ; } ; const deserializeAws_json1_1ReportedOs = ( output , context ) : ReportedOs => { return { Family : __expectString ( output . Family ) , Name : __expectString ( output . Name ) , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1SelfUserProfile = ( output , context ) : SelfUserProfile => { return { IamUserArn : __expectString ( output . IamUserArn ) , Name : __expectString ( output . Name ) , SshPublicKey : __expectString ( output . SshPublicKey ) , SshUsername : __expectString ( output . SshUsername ) , } as any ; } ; const deserializeAws_json1_1ServiceError = ( output , context ) : ServiceError => { return { CreatedAt : __expectString ( output . CreatedAt ) , InstanceId : __expectString ( output . InstanceId ) , Message : __expectString ( output . Message ) , ServiceErrorId : __expectString ( output . ServiceErrorId ) , StackId : __expectString ( output . StackId ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1ServiceErrors = ( output , context ) : ServiceError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ServiceError ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ShutdownEventConfiguration = ( output , context ) : ShutdownEventConfiguration => { return { DelayUntilElbConnectionsDrained : __expectBoolean ( output . DelayUntilElbConnectionsDrained ) , ExecutionTimeout : __expectInt32 ( output . ExecutionTimeout ) , } as any ; } ; const deserializeAws_json1_1Source = ( output , context ) : Source => { return { Password : __expectString ( output . Password ) , Revision : __expectString ( output . Revision ) , SshKey : __expectString ( output . SshKey ) , Type : __expectString ( output . Type ) , Url : __expectString ( output . Url ) , Username : __expectString ( output . Username ) , } as any ; } ; const deserializeAws_json1_1SslConfiguration = ( output , context ) : SslConfiguration => { return { Certificate : __expectString ( output . Certificate ) , Chain : __expectString ( output . Chain ) , PrivateKey : __expectString ( output . PrivateKey ) , } as any ; } ; const deserializeAws_json1_1Stack = ( output , context ) : Stack => { return { AgentVersion : __expectString ( output . AgentVersion ) , Arn : __expectString ( output . Arn ) , Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1StackAttributes ( output . Attributes , context ) : undefined , ChefConfiguration : output . ChefConfiguration !== undefined && output . ChefConfiguration !== null ? deserializeAws_json1_1ChefConfiguration ( output . ChefConfiguration , context ) : undefined , ConfigurationManager : output . ConfigurationManager !== undefined && output . ConfigurationManager !== null ? deserializeAws_json1_1StackConfigurationManager ( output . ConfigurationManager , context ) : undefined , CreatedAt : __expectString ( output . CreatedAt ) , CustomCookbooksSource : output . CustomCookbooksSource !== undefined && output . CustomCookbooksSource !== null ? deserializeAws_json1_1Source ( output . CustomCookbooksSource , context ) : undefined , CustomJson : __expectString ( output . CustomJson ) , DefaultAvailabilityZone : __expectString ( output . DefaultAvailabilityZone ) , DefaultInstanceProfileArn : __expectString ( output . DefaultInstanceProfileArn ) , DefaultOs : __expectString ( output . DefaultOs ) , DefaultRootDeviceType : __expectString ( output . DefaultRootDeviceType ) , DefaultSshKeyName : __expectString ( output . DefaultSshKeyName ) , DefaultSubnetId : __expectString ( output . DefaultSubnetId ) , HostnameTheme : __expectString ( output . HostnameTheme ) , Name : __expectString ( output . Name ) , Region : __expectString ( output . Region ) , ServiceRoleArn : __expectString ( output . ServiceRoleArn ) , StackId : __expectString ( output . StackId ) , UseCustomCookbooks : __expectBoolean ( output . UseCustomCookbooks ) , UseOpsworksSecurityGroups : __expectBoolean ( output . UseOpsworksSecurityGroups ) , VpcId : __expectString ( output . VpcId ) , } as any ; } ; const deserializeAws_json1_1StackAttributes = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1StackConfigurationManager = ( output , context ) : StackConfigurationManager => { return { Name : __expectString ( output . Name ) , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_json1_1Stacks = ( output , context ) : Stack [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Stack ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1StackSummary = ( output , context ) : StackSummary => { return { AppsCount : __expectInt32 ( output . AppsCount ) , Arn : __expectString ( output . Arn ) , InstancesCount : output . InstancesCount !== undefined && output . InstancesCount !== null ? deserializeAws_json1_1InstancesCount ( output . InstancesCount , context ) : undefined , LayersCount : __expectInt32 ( output . LayersCount ) , Name : __expectString ( output . Name ) , StackId : __expectString ( output . StackId ) , } as any ; } ; const deserializeAws_json1_1Strings = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1Tags = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_json1_1TemporaryCredential = ( output , context ) : TemporaryCredential => { return { InstanceId : __expectString ( output . InstanceId ) , Password : __expectString ( output . Password ) , Username : __expectString ( output . Username ) , ValidForInMinutes : __expectInt32 ( output . ValidForInMinutes ) , } as any ; } ; const deserializeAws_json1_1TimeBasedAutoScalingConfiguration = ( output , context ) : TimeBasedAutoScalingConfiguration => { return { AutoScalingSchedule : output . AutoScalingSchedule !== undefined && output . AutoScalingSchedule !== null ? deserializeAws_json1_1WeeklyAutoScalingSchedule ( output . AutoScalingSchedule , context ) : undefined , InstanceId : __expectString ( output . InstanceId ) , } as any ; } ; const deserializeAws_json1_1TimeBasedAutoScalingConfigurations = ( output , context ) : TimeBasedAutoScalingConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1TimeBasedAutoScalingConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1UserProfile = ( output , context ) : UserProfile => { return { AllowSelfManagement : __expectBoolean ( output . AllowSelfManagement ) , IamUserArn : __expectString ( output . IamUserArn ) , Name : __expectString ( output . Name ) , SshPublicKey : __expectString ( output . SshPublicKey ) , SshUsername : __expectString ( output . SshUsername ) , } as any ; } ; const deserializeAws_json1_1UserProfiles = ( output , context ) : UserProfile [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1UserProfile ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ValidationException = ( output , context ) : ValidationException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Volume = ( output , context ) : Volume => { return { AvailabilityZone : __expectString ( output . AvailabilityZone ) , Device : __expectString ( output . Device ) , Ec2VolumeId : __expectString ( output . Ec2VolumeId ) , Encrypted : __expectBoolean ( output . Encrypted ) , InstanceId : __expectString ( output . InstanceId ) , Iops : __expectInt32 ( output . Iops ) , MountPoint : __expectString ( output . MountPoint ) , Name : __expectString ( output . Name ) , RaidArrayId : __expectString ( output . RaidArrayId ) , Region : __expectString ( output . Region ) , Size : __expectInt32 ( output . Size ) , Status : __expectString ( output . Status ) , VolumeId : __expectString ( output . VolumeId ) , VolumeType : __expectString ( output . VolumeType ) , } as any ; } ; const deserializeAws_json1_1VolumeConfiguration = ( output , context ) : VolumeConfiguration => { return { Encrypted : __expectBoolean ( output . Encrypted ) , Iops : __expectInt32 ( output . Iops ) , MountPoint : __expectString ( output . MountPoint ) , NumberOfDisks : __expectInt32 ( output . NumberOfDisks ) , RaidLevel : __expectInt32 ( output . RaidLevel ) , Size : __expectInt32 ( output . Size ) , VolumeType : __expectString ( output . VolumeType ) , } as any ; } ; const deserializeAws_json1_1VolumeConfigurations = ( output , context ) : VolumeConfiguration [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1VolumeConfiguration ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Volumes = ( output , context ) : Volume [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Volume ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1WeeklyAutoScalingSchedule = ( output , context ) : WeeklyAutoScalingSchedule => { return { Friday : output . Friday !== undefined && output . Friday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Friday , context ) : undefined , Monday : output . Monday !== undefined && output . Monday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Monday , context ) : undefined , Saturday : output . Saturday !== undefined && output . Saturday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Saturday , context ) : undefined , Sunday : output . Sunday !== undefined && output . Sunday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Sunday , context ) : undefined , Thursday : output . Thursday !== undefined && output . Thursday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Thursday , context ) : undefined , Tuesday : output . Tuesday !== undefined && output . Tuesday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Tuesday , context ) : undefined , Wednesday : output . Wednesday !== undefined && output . Wednesday !== null ? deserializeAws_json1_1DailyAutoScalingSchedule ( output . Wednesday , context ) : undefined , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { 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 ) ; } ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; 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" ] ) ; } return "" ; } ;