Skip to content

Commit 3c8cd21

Browse files
authored
chore: remove bodyParams from restJson serInputDocument (#1177)
1 parent 50c8411 commit 3c8cd21

File tree

80 files changed

+12173
-16995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+12173
-16995
lines changed

clients/client-accessanalyzer/protocols/Aws_restJson1_1.ts

Lines changed: 66 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -114,29 +114,22 @@ export const serializeAws_restJson1_1CreateAnalyzerCommand = async (
114114
};
115115
let resolvedPath = "/analyzer";
116116
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+
});
140133
const { hostname, protocol = "https", port } = await context.endpoint();
141134
return new __HttpRequest({
142135
protocol,
@@ -172,23 +165,13 @@ export const serializeAws_restJson1_1CreateArchiveRuleCommand = async (
172165
throw new Error("No value provided for input HTTP label: analyzerName.");
173166
}
174167
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+
});
192175
const { hostname, protocol = "https", port } = await context.endpoint();
193176
return new __HttpRequest({
194177
protocol,
@@ -445,20 +428,14 @@ export const serializeAws_restJson1_1ListAnalyzedResourcesCommand = async (
445428
};
446429
let resolvedPath = "/analyzed-resource";
447430
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+
});
462439
const { hostname, protocol = "https", port } = await context.endpoint();
463440
return new __HttpRequest({
464441
protocol,
@@ -551,29 +528,17 @@ export const serializeAws_restJson1_1ListFindingsCommand = async (
551528
};
552529
let resolvedPath = "/finding";
553530
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+
});
577542
const { hostname, protocol = "https", port } = await context.endpoint();
578543
return new __HttpRequest({
579544
protocol,
@@ -630,14 +595,10 @@ export const serializeAws_restJson1_1StartResourceScanCommand = async (
630595
};
631596
let resolvedPath = "/resource/scan";
632597
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+
});
641602
const { hostname, protocol = "https", port } = await context.endpoint();
642603
return new __HttpRequest({
643604
protocol,
@@ -673,11 +634,11 @@ export const serializeAws_restJson1_1TagResourceCommand = async (
673634
throw new Error("No value provided for input HTTP label: resourceArn.");
674635
}
675636
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+
});
681642
const { hostname, protocol = "https", port } = await context.endpoint();
682643
return new __HttpRequest({
683644
protocol,
@@ -766,20 +727,12 @@ export const serializeAws_restJson1_1UpdateArchiveRuleCommand = async (
766727
throw new Error("No value provided for input HTTP label: ruleName.");
767728
}
768729
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+
});
783736
const { hostname, protocol = "https", port } = await context.endpoint();
784737
return new __HttpRequest({
785738
protocol,
@@ -801,29 +754,15 @@ export const serializeAws_restJson1_1UpdateFindingsCommand = async (
801754
};
802755
let resolvedPath = "/finding";
803756
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+
});
827766
const { hostname, protocol = "https", port } = await context.endpoint();
828767
return new __HttpRequest({
829768
protocol,

0 commit comments

Comments
 (0)