@@ -114,29 +114,22 @@ export const serializeAws_restJson1_1CreateAnalyzerCommand = async (
114
114
} ;
115
115
let resolvedPath = "/analyzer" ;
116
116
let body : any ;
117
- const bodyParams : any = { } ;
118
- if ( input . analyzerName !== undefined ) {
119
- bodyParams [ "analyzerName" ] = input . analyzerName ;
120
- }
121
- if ( input . archiveRules !== undefined ) {
122
- bodyParams [ "archiveRules" ] = serializeAws_restJson1_1InlineArchiveRulesList (
123
- input . archiveRules ,
124
- context
125
- ) ;
126
- }
127
- if ( input . clientToken === undefined ) {
128
- input . clientToken = generateIdempotencyToken ( ) ;
129
- }
130
- if ( input . clientToken !== undefined ) {
131
- bodyParams [ "clientToken" ] = input . clientToken ;
132
- }
133
- if ( input . tags !== undefined ) {
134
- bodyParams [ "tags" ] = serializeAws_restJson1_1TagsMap ( input . tags , context ) ;
135
- }
136
- if ( input . type !== undefined ) {
137
- bodyParams [ "type" ] = input . type ;
138
- }
139
- body = JSON . stringify ( bodyParams ) ;
117
+ body = JSON . stringify ( {
118
+ ...( input . analyzerName !== undefined && {
119
+ analyzerName : input . analyzerName
120
+ } ) ,
121
+ ...( input . archiveRules !== undefined && {
122
+ archiveRules : serializeAws_restJson1_1InlineArchiveRulesList (
123
+ input . archiveRules ,
124
+ context
125
+ )
126
+ } ) ,
127
+ clientToken : input . clientToken ?? generateIdempotencyToken ( ) ,
128
+ ...( input . tags !== undefined && {
129
+ tags : serializeAws_restJson1_1TagsMap ( input . tags , context )
130
+ } ) ,
131
+ ...( input . type !== undefined && { type : input . type } )
132
+ } ) ;
140
133
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
141
134
return new __HttpRequest ( {
142
135
protocol,
@@ -172,23 +165,13 @@ export const serializeAws_restJson1_1CreateArchiveRuleCommand = async (
172
165
throw new Error ( "No value provided for input HTTP label: analyzerName." ) ;
173
166
}
174
167
let body : any ;
175
- const bodyParams : any = { } ;
176
- if ( input . clientToken === undefined ) {
177
- input . clientToken = generateIdempotencyToken ( ) ;
178
- }
179
- if ( input . clientToken !== undefined ) {
180
- bodyParams [ "clientToken" ] = input . clientToken ;
181
- }
182
- if ( input . filter !== undefined ) {
183
- bodyParams [ "filter" ] = serializeAws_restJson1_1FilterCriteriaMap (
184
- input . filter ,
185
- context
186
- ) ;
187
- }
188
- if ( input . ruleName !== undefined ) {
189
- bodyParams [ "ruleName" ] = input . ruleName ;
190
- }
191
- body = JSON . stringify ( bodyParams ) ;
168
+ body = JSON . stringify ( {
169
+ clientToken : input . clientToken ?? generateIdempotencyToken ( ) ,
170
+ ...( input . filter !== undefined && {
171
+ filter : serializeAws_restJson1_1FilterCriteriaMap ( input . filter , context )
172
+ } ) ,
173
+ ...( input . ruleName !== undefined && { ruleName : input . ruleName } )
174
+ } ) ;
192
175
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
193
176
return new __HttpRequest ( {
194
177
protocol,
@@ -445,20 +428,14 @@ export const serializeAws_restJson1_1ListAnalyzedResourcesCommand = async (
445
428
} ;
446
429
let resolvedPath = "/analyzed-resource" ;
447
430
let body : any ;
448
- const bodyParams : any = { } ;
449
- if ( input . analyzerArn !== undefined ) {
450
- bodyParams [ "analyzerArn" ] = input . analyzerArn ;
451
- }
452
- if ( input . maxResults !== undefined ) {
453
- bodyParams [ "maxResults" ] = input . maxResults ;
454
- }
455
- if ( input . nextToken !== undefined ) {
456
- bodyParams [ "nextToken" ] = input . nextToken ;
457
- }
458
- if ( input . resourceType !== undefined ) {
459
- bodyParams [ "resourceType" ] = input . resourceType ;
460
- }
461
- body = JSON . stringify ( bodyParams ) ;
431
+ body = JSON . stringify ( {
432
+ ...( input . analyzerArn !== undefined && { analyzerArn : input . analyzerArn } ) ,
433
+ ...( input . maxResults !== undefined && { maxResults : input . maxResults } ) ,
434
+ ...( input . nextToken !== undefined && { nextToken : input . nextToken } ) ,
435
+ ...( input . resourceType !== undefined && {
436
+ resourceType : input . resourceType
437
+ } )
438
+ } ) ;
462
439
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
463
440
return new __HttpRequest ( {
464
441
protocol,
@@ -551,29 +528,17 @@ export const serializeAws_restJson1_1ListFindingsCommand = async (
551
528
} ;
552
529
let resolvedPath = "/finding" ;
553
530
let body : any ;
554
- const bodyParams : any = { } ;
555
- if ( input . analyzerArn !== undefined ) {
556
- bodyParams [ "analyzerArn" ] = input . analyzerArn ;
557
- }
558
- if ( input . filter !== undefined ) {
559
- bodyParams [ "filter" ] = serializeAws_restJson1_1FilterCriteriaMap (
560
- input . filter ,
561
- context
562
- ) ;
563
- }
564
- if ( input . maxResults !== undefined ) {
565
- bodyParams [ "maxResults" ] = input . maxResults ;
566
- }
567
- if ( input . nextToken !== undefined ) {
568
- bodyParams [ "nextToken" ] = input . nextToken ;
569
- }
570
- if ( input . sort !== undefined ) {
571
- bodyParams [ "sort" ] = serializeAws_restJson1_1SortCriteria (
572
- input . sort ,
573
- context
574
- ) ;
575
- }
576
- body = JSON . stringify ( bodyParams ) ;
531
+ body = JSON . stringify ( {
532
+ ...( input . analyzerArn !== undefined && { analyzerArn : input . analyzerArn } ) ,
533
+ ...( input . filter !== undefined && {
534
+ filter : serializeAws_restJson1_1FilterCriteriaMap ( input . filter , context )
535
+ } ) ,
536
+ ...( input . maxResults !== undefined && { maxResults : input . maxResults } ) ,
537
+ ...( input . nextToken !== undefined && { nextToken : input . nextToken } ) ,
538
+ ...( input . sort !== undefined && {
539
+ sort : serializeAws_restJson1_1SortCriteria ( input . sort , context )
540
+ } )
541
+ } ) ;
577
542
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
578
543
return new __HttpRequest ( {
579
544
protocol,
@@ -630,14 +595,10 @@ export const serializeAws_restJson1_1StartResourceScanCommand = async (
630
595
} ;
631
596
let resolvedPath = "/resource/scan" ;
632
597
let body : any ;
633
- const bodyParams : any = { } ;
634
- if ( input . analyzerArn !== undefined ) {
635
- bodyParams [ "analyzerArn" ] = input . analyzerArn ;
636
- }
637
- if ( input . resourceArn !== undefined ) {
638
- bodyParams [ "resourceArn" ] = input . resourceArn ;
639
- }
640
- body = JSON . stringify ( bodyParams ) ;
598
+ body = JSON . stringify ( {
599
+ ...( input . analyzerArn !== undefined && { analyzerArn : input . analyzerArn } ) ,
600
+ ...( input . resourceArn !== undefined && { resourceArn : input . resourceArn } )
601
+ } ) ;
641
602
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
642
603
return new __HttpRequest ( {
643
604
protocol,
@@ -673,11 +634,11 @@ export const serializeAws_restJson1_1TagResourceCommand = async (
673
634
throw new Error ( "No value provided for input HTTP label: resourceArn." ) ;
674
635
}
675
636
let body : any ;
676
- const bodyParams : any = { } ;
677
- if ( input . tags !== undefined ) {
678
- bodyParams [ "tags" ] = serializeAws_restJson1_1TagsMap ( input . tags , context ) ;
679
- }
680
- body = JSON . stringify ( bodyParams ) ;
637
+ body = JSON . stringify ( {
638
+ ... ( input . tags !== undefined && {
639
+ tags : serializeAws_restJson1_1TagsMap ( input . tags , context )
640
+ } )
641
+ } ) ;
681
642
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
682
643
return new __HttpRequest ( {
683
644
protocol,
@@ -766,20 +727,12 @@ export const serializeAws_restJson1_1UpdateArchiveRuleCommand = async (
766
727
throw new Error ( "No value provided for input HTTP label: ruleName." ) ;
767
728
}
768
729
let body : any ;
769
- const bodyParams : any = { } ;
770
- if ( input . clientToken === undefined ) {
771
- input . clientToken = generateIdempotencyToken ( ) ;
772
- }
773
- if ( input . clientToken !== undefined ) {
774
- bodyParams [ "clientToken" ] = input . clientToken ;
775
- }
776
- if ( input . filter !== undefined ) {
777
- bodyParams [ "filter" ] = serializeAws_restJson1_1FilterCriteriaMap (
778
- input . filter ,
779
- context
780
- ) ;
781
- }
782
- body = JSON . stringify ( bodyParams ) ;
730
+ body = JSON . stringify ( {
731
+ clientToken : input . clientToken ?? generateIdempotencyToken ( ) ,
732
+ ...( input . filter !== undefined && {
733
+ filter : serializeAws_restJson1_1FilterCriteriaMap ( input . filter , context )
734
+ } )
735
+ } ) ;
783
736
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
784
737
return new __HttpRequest ( {
785
738
protocol,
@@ -801,29 +754,15 @@ export const serializeAws_restJson1_1UpdateFindingsCommand = async (
801
754
} ;
802
755
let resolvedPath = "/finding" ;
803
756
let body : any ;
804
- const bodyParams : any = { } ;
805
- if ( input . analyzerArn !== undefined ) {
806
- bodyParams [ "analyzerArn" ] = input . analyzerArn ;
807
- }
808
- if ( input . clientToken === undefined ) {
809
- input . clientToken = generateIdempotencyToken ( ) ;
810
- }
811
- if ( input . clientToken !== undefined ) {
812
- bodyParams [ "clientToken" ] = input . clientToken ;
813
- }
814
- if ( input . ids !== undefined ) {
815
- bodyParams [ "ids" ] = serializeAws_restJson1_1FindingIdList (
816
- input . ids ,
817
- context
818
- ) ;
819
- }
820
- if ( input . resourceArn !== undefined ) {
821
- bodyParams [ "resourceArn" ] = input . resourceArn ;
822
- }
823
- if ( input . status !== undefined ) {
824
- bodyParams [ "status" ] = input . status ;
825
- }
826
- body = JSON . stringify ( bodyParams ) ;
757
+ body = JSON . stringify ( {
758
+ ...( input . analyzerArn !== undefined && { analyzerArn : input . analyzerArn } ) ,
759
+ clientToken : input . clientToken ?? generateIdempotencyToken ( ) ,
760
+ ...( input . ids !== undefined && {
761
+ ids : serializeAws_restJson1_1FindingIdList ( input . ids , context )
762
+ } ) ,
763
+ ...( input . resourceArn !== undefined && { resourceArn : input . resourceArn } ) ,
764
+ ...( input . status !== undefined && { status : input . status } )
765
+ } ) ;
827
766
const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
828
767
return new __HttpRequest ( {
829
768
protocol,
0 commit comments