Skip to content

Commit f1fef16

Browse files
committed
feat: codegen for protocol size reduction
1 parent 2e8b66f commit f1fef16

File tree

480 files changed

+112952
-184013
lines changed

Some content is hidden

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

480 files changed

+112952
-184013
lines changed

clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts

Lines changed: 192 additions & 501 deletions
Large diffs are not rendered by default.

clients/client-account/src/protocols/Aws_restJson1.ts

Lines changed: 41 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { requestBuilder as rb } from "@smithy/core";
23
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
34
import {
45
_json,
@@ -60,28 +61,20 @@ export const se_DeleteAlternateContactCommand = async (
6061
input: DeleteAlternateContactCommandInput,
6162
context: __SerdeContext
6263
): Promise<__HttpRequest> => {
63-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
64+
const b = rb(input, context);
6465
const headers: any = {
6566
"content-type": "application/json",
6667
};
67-
const resolvedPath =
68-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteAlternateContact";
68+
b.bp("/deleteAlternateContact");
6969
let body: any;
7070
body = JSON.stringify(
7171
take(input, {
7272
AccountId: [],
7373
AlternateContactType: [],
7474
})
7575
);
76-
return new __HttpRequest({
77-
protocol,
78-
hostname,
79-
port,
80-
method: "POST",
81-
headers,
82-
path: resolvedPath,
83-
body,
84-
});
76+
b.m("POST").h(headers).b(body);
77+
return b.build();
8578
};
8679

8780
/**
@@ -91,27 +84,20 @@ export const se_DisableRegionCommand = async (
9184
input: DisableRegionCommandInput,
9285
context: __SerdeContext
9386
): Promise<__HttpRequest> => {
94-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
87+
const b = rb(input, context);
9588
const headers: any = {
9689
"content-type": "application/json",
9790
};
98-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disableRegion";
91+
b.bp("/disableRegion");
9992
let body: any;
10093
body = JSON.stringify(
10194
take(input, {
10295
AccountId: [],
10396
RegionName: [],
10497
})
10598
);
106-
return new __HttpRequest({
107-
protocol,
108-
hostname,
109-
port,
110-
method: "POST",
111-
headers,
112-
path: resolvedPath,
113-
body,
114-
});
99+
b.m("POST").h(headers).b(body);
100+
return b.build();
115101
};
116102

117103
/**
@@ -121,27 +107,20 @@ export const se_EnableRegionCommand = async (
121107
input: EnableRegionCommandInput,
122108
context: __SerdeContext
123109
): Promise<__HttpRequest> => {
124-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
110+
const b = rb(input, context);
125111
const headers: any = {
126112
"content-type": "application/json",
127113
};
128-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/enableRegion";
114+
b.bp("/enableRegion");
129115
let body: any;
130116
body = JSON.stringify(
131117
take(input, {
132118
AccountId: [],
133119
RegionName: [],
134120
})
135121
);
136-
return new __HttpRequest({
137-
protocol,
138-
hostname,
139-
port,
140-
method: "POST",
141-
headers,
142-
path: resolvedPath,
143-
body,
144-
});
122+
b.m("POST").h(headers).b(body);
123+
return b.build();
145124
};
146125

147126
/**
@@ -151,27 +130,20 @@ export const se_GetAlternateContactCommand = async (
151130
input: GetAlternateContactCommandInput,
152131
context: __SerdeContext
153132
): Promise<__HttpRequest> => {
154-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
133+
const b = rb(input, context);
155134
const headers: any = {
156135
"content-type": "application/json",
157136
};
158-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getAlternateContact";
137+
b.bp("/getAlternateContact");
159138
let body: any;
160139
body = JSON.stringify(
161140
take(input, {
162141
AccountId: [],
163142
AlternateContactType: [],
164143
})
165144
);
166-
return new __HttpRequest({
167-
protocol,
168-
hostname,
169-
port,
170-
method: "POST",
171-
headers,
172-
path: resolvedPath,
173-
body,
174-
});
145+
b.m("POST").h(headers).b(body);
146+
return b.build();
175147
};
176148

177149
/**
@@ -181,26 +153,19 @@ export const se_GetContactInformationCommand = async (
181153
input: GetContactInformationCommandInput,
182154
context: __SerdeContext
183155
): Promise<__HttpRequest> => {
184-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
156+
const b = rb(input, context);
185157
const headers: any = {
186158
"content-type": "application/json",
187159
};
188-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getContactInformation";
160+
b.bp("/getContactInformation");
189161
let body: any;
190162
body = JSON.stringify(
191163
take(input, {
192164
AccountId: [],
193165
})
194166
);
195-
return new __HttpRequest({
196-
protocol,
197-
hostname,
198-
port,
199-
method: "POST",
200-
headers,
201-
path: resolvedPath,
202-
body,
203-
});
167+
b.m("POST").h(headers).b(body);
168+
return b.build();
204169
};
205170

206171
/**
@@ -210,27 +175,20 @@ export const se_GetRegionOptStatusCommand = async (
210175
input: GetRegionOptStatusCommandInput,
211176
context: __SerdeContext
212177
): Promise<__HttpRequest> => {
213-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
178+
const b = rb(input, context);
214179
const headers: any = {
215180
"content-type": "application/json",
216181
};
217-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getRegionOptStatus";
182+
b.bp("/getRegionOptStatus");
218183
let body: any;
219184
body = JSON.stringify(
220185
take(input, {
221186
AccountId: [],
222187
RegionName: [],
223188
})
224189
);
225-
return new __HttpRequest({
226-
protocol,
227-
hostname,
228-
port,
229-
method: "POST",
230-
headers,
231-
path: resolvedPath,
232-
body,
233-
});
190+
b.m("POST").h(headers).b(body);
191+
return b.build();
234192
};
235193

236194
/**
@@ -240,11 +198,11 @@ export const se_ListRegionsCommand = async (
240198
input: ListRegionsCommandInput,
241199
context: __SerdeContext
242200
): Promise<__HttpRequest> => {
243-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
201+
const b = rb(input, context);
244202
const headers: any = {
245203
"content-type": "application/json",
246204
};
247-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listRegions";
205+
b.bp("/listRegions");
248206
let body: any;
249207
body = JSON.stringify(
250208
take(input, {
@@ -254,15 +212,8 @@ export const se_ListRegionsCommand = async (
254212
RegionOptStatusContains: (_) => _json(_),
255213
})
256214
);
257-
return new __HttpRequest({
258-
protocol,
259-
hostname,
260-
port,
261-
method: "POST",
262-
headers,
263-
path: resolvedPath,
264-
body,
265-
});
215+
b.m("POST").h(headers).b(body);
216+
return b.build();
266217
};
267218

268219
/**
@@ -272,11 +223,11 @@ export const se_PutAlternateContactCommand = async (
272223
input: PutAlternateContactCommandInput,
273224
context: __SerdeContext
274225
): Promise<__HttpRequest> => {
275-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
226+
const b = rb(input, context);
276227
const headers: any = {
277228
"content-type": "application/json",
278229
};
279-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putAlternateContact";
230+
b.bp("/putAlternateContact");
280231
let body: any;
281232
body = JSON.stringify(
282233
take(input, {
@@ -288,15 +239,8 @@ export const se_PutAlternateContactCommand = async (
288239
Title: [],
289240
})
290241
);
291-
return new __HttpRequest({
292-
protocol,
293-
hostname,
294-
port,
295-
method: "POST",
296-
headers,
297-
path: resolvedPath,
298-
body,
299-
});
242+
b.m("POST").h(headers).b(body);
243+
return b.build();
300244
};
301245

302246
/**
@@ -306,27 +250,20 @@ export const se_PutContactInformationCommand = async (
306250
input: PutContactInformationCommandInput,
307251
context: __SerdeContext
308252
): Promise<__HttpRequest> => {
309-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
253+
const b = rb(input, context);
310254
const headers: any = {
311255
"content-type": "application/json",
312256
};
313-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putContactInformation";
257+
b.bp("/putContactInformation");
314258
let body: any;
315259
body = JSON.stringify(
316260
take(input, {
317261
AccountId: [],
318262
ContactInformation: (_) => _json(_),
319263
})
320264
);
321-
return new __HttpRequest({
322-
protocol,
323-
hostname,
324-
port,
325-
method: "POST",
326-
headers,
327-
path: resolvedPath,
328-
body,
329-
});
265+
b.m("POST").h(headers).b(body);
266+
return b.build();
330267
};
331268

332269
/**
@@ -982,6 +919,8 @@ const isSerializableHeaderValue = (value: any): boolean =>
982919
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
983920
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
984921

922+
// HttpBindingProtocolGenerator
923+
985924
const parseBody = (streamBody: any, context: __SerdeContext): any =>
986925
collectBodyString(streamBody, context).then((encoded) => {
987926
if (encoded.length) {
@@ -1032,3 +971,5 @@ const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | unde
1032971
return sanitizeErrorCode(data["__type"]);
1033972
}
1034973
};
974+
975+
// RestJsonProtocolGenerator

clients/client-acm-pca/src/protocols/Aws_json1_1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,8 @@ function sharedHeaders(operation: string): __HeaderBag {
24172417
};
24182418
}
24192419

2420+
// HttpRpcProtocolGenerator
2421+
24202422
const parseBody = (streamBody: any, context: __SerdeContext): any =>
24212423
collectBodyString(streamBody, context).then((encoded) => {
24222424
if (encoded.length) {
@@ -2467,3 +2469,5 @@ const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | unde
24672469
return sanitizeErrorCode(data["__type"]);
24682470
}
24692471
};
2472+
2473+
// JsonRpcProtocolGenerator

clients/client-acm/src/protocols/Aws_json1_1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,8 @@ function sharedHeaders(operation: string): __HeaderBag {
16391639
};
16401640
}
16411641

1642+
// HttpRpcProtocolGenerator
1643+
16421644
const parseBody = (streamBody: any, context: __SerdeContext): any =>
16431645
collectBodyString(streamBody, context).then((encoded) => {
16441646
if (encoded.length) {
@@ -1689,3 +1691,5 @@ const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | unde
16891691
return sanitizeErrorCode(data["__type"]);
16901692
}
16911693
};
1694+
1695+
// JsonRpcProtocolGenerator

clients/client-alexa-for-business/src/protocols/Aws_json1_1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7192,6 +7192,8 @@ function sharedHeaders(operation: string): __HeaderBag {
71927192
};
71937193
}
71947194

7195+
// HttpRpcProtocolGenerator
7196+
71957197
const parseBody = (streamBody: any, context: __SerdeContext): any =>
71967198
collectBodyString(streamBody, context).then((encoded) => {
71977199
if (encoded.length) {
@@ -7242,3 +7244,5 @@ const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | unde
72427244
return sanitizeErrorCode(data["__type"]);
72437245
}
72447246
};
7247+
7248+
// JsonRpcProtocolGenerator

0 commit comments

Comments
 (0)