@aws-sdk/client-outposts 3.141.0 → 3.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,16 +10,7 @@ const serializeAws_restJson1CancelOrderCommand = async (input, context) => {
10
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/orders/{OrderId}/cancel";
13
- if (input.OrderId !== undefined) {
14
- const labelValue = input.OrderId;
15
- if (labelValue.length <= 0) {
16
- throw new Error("Empty value provided for input HTTP label: OrderId.");
17
- }
18
- resolvedPath = resolvedPath.replace("{OrderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
19
- }
20
- else {
21
- throw new Error("No value provided for input HTTP label: OrderId.");
22
- }
13
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OrderId", () => input.OrderId, "{OrderId}", false);
23
14
  let body;
24
15
  return new protocol_http_1.HttpRequest({
25
16
  protocol,
@@ -122,16 +113,7 @@ const serializeAws_restJson1DeleteOutpostCommand = async (input, context) => {
122
113
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
123
114
  const headers = {};
124
115
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}";
125
- if (input.OutpostId !== undefined) {
126
- const labelValue = input.OutpostId;
127
- if (labelValue.length <= 0) {
128
- throw new Error("Empty value provided for input HTTP label: OutpostId.");
129
- }
130
- resolvedPath = resolvedPath.replace("{OutpostId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
131
- }
132
- else {
133
- throw new Error("No value provided for input HTTP label: OutpostId.");
134
- }
116
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutpostId", () => input.OutpostId, "{OutpostId}", false);
135
117
  let body;
136
118
  return new protocol_http_1.HttpRequest({
137
119
  protocol,
@@ -148,16 +130,7 @@ const serializeAws_restJson1DeleteSiteCommand = async (input, context) => {
148
130
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
149
131
  const headers = {};
150
132
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}";
151
- if (input.SiteId !== undefined) {
152
- const labelValue = input.SiteId;
153
- if (labelValue.length <= 0) {
154
- throw new Error("Empty value provided for input HTTP label: SiteId.");
155
- }
156
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
157
- }
158
- else {
159
- throw new Error("No value provided for input HTTP label: SiteId.");
160
- }
133
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
161
134
  let body;
162
135
  return new protocol_http_1.HttpRequest({
163
136
  protocol,
@@ -174,16 +147,7 @@ const serializeAws_restJson1GetCatalogItemCommand = async (input, context) => {
174
147
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
175
148
  const headers = {};
176
149
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/catalog/item/{CatalogItemId}";
177
- if (input.CatalogItemId !== undefined) {
178
- const labelValue = input.CatalogItemId;
179
- if (labelValue.length <= 0) {
180
- throw new Error("Empty value provided for input HTTP label: CatalogItemId.");
181
- }
182
- resolvedPath = resolvedPath.replace("{CatalogItemId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
183
- }
184
- else {
185
- throw new Error("No value provided for input HTTP label: CatalogItemId.");
186
- }
150
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CatalogItemId", () => input.CatalogItemId, "{CatalogItemId}", false);
187
151
  let body;
188
152
  return new protocol_http_1.HttpRequest({
189
153
  protocol,
@@ -200,16 +164,7 @@ const serializeAws_restJson1GetConnectionCommand = async (input, context) => {
200
164
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
201
165
  const headers = {};
202
166
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/connections/{ConnectionId}";
203
- if (input.ConnectionId !== undefined) {
204
- const labelValue = input.ConnectionId;
205
- if (labelValue.length <= 0) {
206
- throw new Error("Empty value provided for input HTTP label: ConnectionId.");
207
- }
208
- resolvedPath = resolvedPath.replace("{ConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
209
- }
210
- else {
211
- throw new Error("No value provided for input HTTP label: ConnectionId.");
212
- }
167
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
213
168
  let body;
214
169
  return new protocol_http_1.HttpRequest({
215
170
  protocol,
@@ -226,16 +181,7 @@ const serializeAws_restJson1GetOrderCommand = async (input, context) => {
226
181
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
227
182
  const headers = {};
228
183
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/orders/{OrderId}";
229
- if (input.OrderId !== undefined) {
230
- const labelValue = input.OrderId;
231
- if (labelValue.length <= 0) {
232
- throw new Error("Empty value provided for input HTTP label: OrderId.");
233
- }
234
- resolvedPath = resolvedPath.replace("{OrderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
235
- }
236
- else {
237
- throw new Error("No value provided for input HTTP label: OrderId.");
238
- }
184
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OrderId", () => input.OrderId, "{OrderId}", false);
239
185
  let body;
240
186
  return new protocol_http_1.HttpRequest({
241
187
  protocol,
@@ -252,16 +198,7 @@ const serializeAws_restJson1GetOutpostCommand = async (input, context) => {
252
198
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
253
199
  const headers = {};
254
200
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}";
255
- if (input.OutpostId !== undefined) {
256
- const labelValue = input.OutpostId;
257
- if (labelValue.length <= 0) {
258
- throw new Error("Empty value provided for input HTTP label: OutpostId.");
259
- }
260
- resolvedPath = resolvedPath.replace("{OutpostId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
261
- }
262
- else {
263
- throw new Error("No value provided for input HTTP label: OutpostId.");
264
- }
201
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutpostId", () => input.OutpostId, "{OutpostId}", false);
265
202
  let body;
266
203
  return new protocol_http_1.HttpRequest({
267
204
  protocol,
@@ -278,20 +215,11 @@ const serializeAws_restJson1GetOutpostInstanceTypesCommand = async (input, conte
278
215
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
279
216
  const headers = {};
280
217
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}/instanceTypes";
281
- if (input.OutpostId !== undefined) {
282
- const labelValue = input.OutpostId;
283
- if (labelValue.length <= 0) {
284
- throw new Error("Empty value provided for input HTTP label: OutpostId.");
285
- }
286
- resolvedPath = resolvedPath.replace("{OutpostId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
287
- }
288
- else {
289
- throw new Error("No value provided for input HTTP label: OutpostId.");
290
- }
291
- const query = {
292
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
293
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
294
- };
218
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutpostId", () => input.OutpostId, "{OutpostId}", false);
219
+ const query = map({
220
+ NextToken: [, input.NextToken],
221
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
222
+ });
295
223
  let body;
296
224
  return new protocol_http_1.HttpRequest({
297
225
  protocol,
@@ -309,16 +237,7 @@ const serializeAws_restJson1GetSiteCommand = async (input, context) => {
309
237
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
310
238
  const headers = {};
311
239
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}";
312
- if (input.SiteId !== undefined) {
313
- const labelValue = input.SiteId;
314
- if (labelValue.length <= 0) {
315
- throw new Error("Empty value provided for input HTTP label: SiteId.");
316
- }
317
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
318
- }
319
- else {
320
- throw new Error("No value provided for input HTTP label: SiteId.");
321
- }
240
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
322
241
  let body;
323
242
  return new protocol_http_1.HttpRequest({
324
243
  protocol,
@@ -335,19 +254,10 @@ const serializeAws_restJson1GetSiteAddressCommand = async (input, context) => {
335
254
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
336
255
  const headers = {};
337
256
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}/address";
338
- if (input.SiteId !== undefined) {
339
- const labelValue = input.SiteId;
340
- if (labelValue.length <= 0) {
341
- throw new Error("Empty value provided for input HTTP label: SiteId.");
342
- }
343
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
344
- }
345
- else {
346
- throw new Error("No value provided for input HTTP label: SiteId.");
347
- }
348
- const query = {
349
- ...(input.AddressType !== undefined && { AddressType: input.AddressType }),
350
- };
257
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
258
+ const query = map({
259
+ AddressType: [, input.AddressType],
260
+ });
351
261
  let body;
352
262
  return new protocol_http_1.HttpRequest({
353
263
  protocol,
@@ -365,23 +275,15 @@ const serializeAws_restJson1ListAssetsCommand = async (input, context) => {
365
275
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
366
276
  const headers = {};
367
277
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostIdentifier}/assets";
368
- if (input.OutpostIdentifier !== undefined) {
369
- const labelValue = input.OutpostIdentifier;
370
- if (labelValue.length <= 0) {
371
- throw new Error("Empty value provided for input HTTP label: OutpostIdentifier.");
372
- }
373
- resolvedPath = resolvedPath.replace("{OutpostIdentifier}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
374
- }
375
- else {
376
- throw new Error("No value provided for input HTTP label: OutpostIdentifier.");
377
- }
378
- const query = {
379
- ...(input.HostIdFilter !== undefined && {
380
- HostIdFilter: (input.HostIdFilter || []).map((_entry) => _entry),
381
- }),
382
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
383
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
384
- };
278
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutpostIdentifier", () => input.OutpostIdentifier, "{OutpostIdentifier}", false);
279
+ const query = map({
280
+ HostIdFilter: [
281
+ () => input.HostIdFilter !== void 0,
282
+ () => (input.HostIdFilter || []).map((_entry) => _entry),
283
+ ],
284
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
285
+ NextToken: [, input.NextToken],
286
+ });
385
287
  let body;
386
288
  return new protocol_http_1.HttpRequest({
387
289
  protocol,
@@ -399,19 +301,22 @@ const serializeAws_restJson1ListCatalogItemsCommand = async (input, context) =>
399
301
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
400
302
  const headers = {};
401
303
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/catalog/items";
402
- const query = {
403
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
404
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
405
- ...(input.ItemClassFilter !== undefined && {
406
- ItemClassFilter: (input.ItemClassFilter || []).map((_entry) => _entry),
407
- }),
408
- ...(input.SupportedStorageFilter !== undefined && {
409
- SupportedStorageFilter: (input.SupportedStorageFilter || []).map((_entry) => _entry),
410
- }),
411
- ...(input.EC2FamilyFilter !== undefined && {
412
- EC2FamilyFilter: (input.EC2FamilyFilter || []).map((_entry) => _entry),
413
- }),
414
- };
304
+ const query = map({
305
+ NextToken: [, input.NextToken],
306
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
307
+ ItemClassFilter: [
308
+ () => input.ItemClassFilter !== void 0,
309
+ () => (input.ItemClassFilter || []).map((_entry) => _entry),
310
+ ],
311
+ SupportedStorageFilter: [
312
+ () => input.SupportedStorageFilter !== void 0,
313
+ () => (input.SupportedStorageFilter || []).map((_entry) => _entry),
314
+ ],
315
+ EC2FamilyFilter: [
316
+ () => input.EC2FamilyFilter !== void 0,
317
+ () => (input.EC2FamilyFilter || []).map((_entry) => _entry),
318
+ ],
319
+ });
415
320
  let body;
416
321
  return new protocol_http_1.HttpRequest({
417
322
  protocol,
@@ -429,11 +334,11 @@ const serializeAws_restJson1ListOrdersCommand = async (input, context) => {
429
334
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
430
335
  const headers = {};
431
336
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-orders";
432
- const query = {
433
- ...(input.OutpostIdentifierFilter !== undefined && { OutpostIdentifierFilter: input.OutpostIdentifierFilter }),
434
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
435
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
436
- };
337
+ const query = map({
338
+ OutpostIdentifierFilter: [, input.OutpostIdentifierFilter],
339
+ NextToken: [, input.NextToken],
340
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
341
+ });
437
342
  let body;
438
343
  return new protocol_http_1.HttpRequest({
439
344
  protocol,
@@ -451,19 +356,22 @@ const serializeAws_restJson1ListOutpostsCommand = async (input, context) => {
451
356
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
452
357
  const headers = {};
453
358
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts";
454
- const query = {
455
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
456
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
457
- ...(input.LifeCycleStatusFilter !== undefined && {
458
- LifeCycleStatusFilter: (input.LifeCycleStatusFilter || []).map((_entry) => _entry),
459
- }),
460
- ...(input.AvailabilityZoneFilter !== undefined && {
461
- AvailabilityZoneFilter: (input.AvailabilityZoneFilter || []).map((_entry) => _entry),
462
- }),
463
- ...(input.AvailabilityZoneIdFilter !== undefined && {
464
- AvailabilityZoneIdFilter: (input.AvailabilityZoneIdFilter || []).map((_entry) => _entry),
465
- }),
466
- };
359
+ const query = map({
360
+ NextToken: [, input.NextToken],
361
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
362
+ LifeCycleStatusFilter: [
363
+ () => input.LifeCycleStatusFilter !== void 0,
364
+ () => (input.LifeCycleStatusFilter || []).map((_entry) => _entry),
365
+ ],
366
+ AvailabilityZoneFilter: [
367
+ () => input.AvailabilityZoneFilter !== void 0,
368
+ () => (input.AvailabilityZoneFilter || []).map((_entry) => _entry),
369
+ ],
370
+ AvailabilityZoneIdFilter: [
371
+ () => input.AvailabilityZoneIdFilter !== void 0,
372
+ () => (input.AvailabilityZoneIdFilter || []).map((_entry) => _entry),
373
+ ],
374
+ });
467
375
  let body;
468
376
  return new protocol_http_1.HttpRequest({
469
377
  protocol,
@@ -481,19 +389,22 @@ const serializeAws_restJson1ListSitesCommand = async (input, context) => {
481
389
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
482
390
  const headers = {};
483
391
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites";
484
- const query = {
485
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
486
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
487
- ...(input.OperatingAddressCountryCodeFilter !== undefined && {
488
- OperatingAddressCountryCodeFilter: (input.OperatingAddressCountryCodeFilter || []).map((_entry) => _entry),
489
- }),
490
- ...(input.OperatingAddressStateOrRegionFilter !== undefined && {
491
- OperatingAddressStateOrRegionFilter: (input.OperatingAddressStateOrRegionFilter || []).map((_entry) => _entry),
492
- }),
493
- ...(input.OperatingAddressCityFilter !== undefined && {
494
- OperatingAddressCityFilter: (input.OperatingAddressCityFilter || []).map((_entry) => _entry),
495
- }),
496
- };
392
+ const query = map({
393
+ NextToken: [, input.NextToken],
394
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
395
+ OperatingAddressCountryCodeFilter: [
396
+ () => input.OperatingAddressCountryCodeFilter !== void 0,
397
+ () => (input.OperatingAddressCountryCodeFilter || []).map((_entry) => _entry),
398
+ ],
399
+ OperatingAddressStateOrRegionFilter: [
400
+ () => input.OperatingAddressStateOrRegionFilter !== void 0,
401
+ () => (input.OperatingAddressStateOrRegionFilter || []).map((_entry) => _entry),
402
+ ],
403
+ OperatingAddressCityFilter: [
404
+ () => input.OperatingAddressCityFilter !== void 0,
405
+ () => (input.OperatingAddressCityFilter || []).map((_entry) => _entry),
406
+ ],
407
+ });
497
408
  let body;
498
409
  return new protocol_http_1.HttpRequest({
499
410
  protocol,
@@ -511,16 +422,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
511
422
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
512
423
  const headers = {};
513
424
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
514
- if (input.ResourceArn !== undefined) {
515
- const labelValue = input.ResourceArn;
516
- if (labelValue.length <= 0) {
517
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
518
- }
519
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
520
- }
521
- else {
522
- throw new Error("No value provided for input HTTP label: ResourceArn.");
523
- }
425
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
524
426
  let body;
525
427
  return new protocol_http_1.HttpRequest({
526
428
  protocol,
@@ -565,16 +467,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
565
467
  "content-type": "application/json",
566
468
  };
567
469
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
568
- if (input.ResourceArn !== undefined) {
569
- const labelValue = input.ResourceArn;
570
- if (labelValue.length <= 0) {
571
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
572
- }
573
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
574
- }
575
- else {
576
- throw new Error("No value provided for input HTTP label: ResourceArn.");
577
- }
470
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
578
471
  let body;
579
472
  body = JSON.stringify({
580
473
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -594,19 +487,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
594
487
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
595
488
  const headers = {};
596
489
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
597
- if (input.ResourceArn !== undefined) {
598
- const labelValue = input.ResourceArn;
599
- if (labelValue.length <= 0) {
600
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
601
- }
602
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
603
- }
604
- else {
605
- throw new Error("No value provided for input HTTP label: ResourceArn.");
606
- }
607
- const query = {
608
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
609
- };
490
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
491
+ const query = map({
492
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
493
+ });
610
494
  let body;
611
495
  return new protocol_http_1.HttpRequest({
612
496
  protocol,
@@ -626,16 +510,7 @@ const serializeAws_restJson1UpdateOutpostCommand = async (input, context) => {
626
510
  "content-type": "application/json",
627
511
  };
628
512
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}";
629
- if (input.OutpostId !== undefined) {
630
- const labelValue = input.OutpostId;
631
- if (labelValue.length <= 0) {
632
- throw new Error("Empty value provided for input HTTP label: OutpostId.");
633
- }
634
- resolvedPath = resolvedPath.replace("{OutpostId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
635
- }
636
- else {
637
- throw new Error("No value provided for input HTTP label: OutpostId.");
638
- }
513
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutpostId", () => input.OutpostId, "{OutpostId}", false);
639
514
  let body;
640
515
  body = JSON.stringify({
641
516
  ...(input.Description != null && { Description: input.Description }),
@@ -659,16 +534,7 @@ const serializeAws_restJson1UpdateSiteCommand = async (input, context) => {
659
534
  "content-type": "application/json",
660
535
  };
661
536
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}";
662
- if (input.SiteId !== undefined) {
663
- const labelValue = input.SiteId;
664
- if (labelValue.length <= 0) {
665
- throw new Error("Empty value provided for input HTTP label: SiteId.");
666
- }
667
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
668
- }
669
- else {
670
- throw new Error("No value provided for input HTTP label: SiteId.");
671
- }
537
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
672
538
  let body;
673
539
  body = JSON.stringify({
674
540
  ...(input.Description != null && { Description: input.Description }),
@@ -692,16 +558,7 @@ const serializeAws_restJson1UpdateSiteAddressCommand = async (input, context) =>
692
558
  "content-type": "application/json",
693
559
  };
694
560
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}/address";
695
- if (input.SiteId !== undefined) {
696
- const labelValue = input.SiteId;
697
- if (labelValue.length <= 0) {
698
- throw new Error("Empty value provided for input HTTP label: SiteId.");
699
- }
700
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
701
- }
702
- else {
703
- throw new Error("No value provided for input HTTP label: SiteId.");
704
- }
561
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
705
562
  let body;
706
563
  body = JSON.stringify({
707
564
  ...(input.Address != null && { Address: serializeAws_restJson1Address(input.Address, context) }),
@@ -724,16 +581,7 @@ const serializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommand = async (inp
724
581
  "content-type": "application/json",
725
582
  };
726
583
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}/rackPhysicalProperties";
727
- if (input.SiteId !== undefined) {
728
- const labelValue = input.SiteId;
729
- if (labelValue.length <= 0) {
730
- throw new Error("Empty value provided for input HTTP label: SiteId.");
731
- }
732
- resolvedPath = resolvedPath.replace("{SiteId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
733
- }
734
- else {
735
- throw new Error("No value provided for input HTTP label: SiteId.");
736
- }
584
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SiteId", () => input.SiteId, "{SiteId}", false);
737
585
  let body;
738
586
  body = JSON.stringify({
739
587
  ...(input.FiberOpticCableType != null && { FiberOpticCableType: input.FiberOpticCableType }),
@@ -761,11 +609,11 @@ const deserializeAws_restJson1CancelOrderCommand = async (output, context) => {
761
609
  if (output.statusCode !== 200 && output.statusCode >= 300) {
762
610
  return deserializeAws_restJson1CancelOrderCommandError(output, context);
763
611
  }
764
- const contents = {
612
+ const contents = map({
765
613
  $metadata: deserializeMetadata(output),
766
- };
614
+ });
767
615
  await collectBody(output.body, context);
768
- return Promise.resolve(contents);
616
+ return contents;
769
617
  };
770
618
  exports.deserializeAws_restJson1CancelOrderCommand = deserializeAws_restJson1CancelOrderCommand;
771
619
  const deserializeAws_restJson1CancelOrderCommandError = async (output, context) => {
@@ -773,7 +621,6 @@ const deserializeAws_restJson1CancelOrderCommandError = async (output, context)
773
621
  ...output,
774
622
  body: await parseBody(output.body, context),
775
623
  };
776
- let response;
777
624
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
778
625
  switch (errorCode) {
779
626
  case "AccessDeniedException":
@@ -793,29 +640,26 @@ const deserializeAws_restJson1CancelOrderCommandError = async (output, context)
793
640
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
794
641
  default:
795
642
  const parsedBody = parsedOutput.body;
796
- const $metadata = deserializeMetadata(output);
797
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
798
- response = new OutpostsServiceException_1.OutpostsServiceException({
799
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
800
- $fault: "client",
801
- $metadata,
643
+ (0, smithy_client_1.throwDefaultError)({
644
+ output,
645
+ parsedBody,
646
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
647
+ errorCode,
802
648
  });
803
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
804
649
  }
805
650
  };
806
651
  const deserializeAws_restJson1CreateOrderCommand = async (output, context) => {
807
652
  if (output.statusCode !== 200 && output.statusCode >= 300) {
808
653
  return deserializeAws_restJson1CreateOrderCommandError(output, context);
809
654
  }
810
- const contents = {
655
+ const contents = map({
811
656
  $metadata: deserializeMetadata(output),
812
- Order: undefined,
813
- };
657
+ });
814
658
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
815
- if (data.Order !== undefined && data.Order !== null) {
659
+ if (data.Order != null) {
816
660
  contents.Order = deserializeAws_restJson1Order(data.Order, context);
817
661
  }
818
- return Promise.resolve(contents);
662
+ return contents;
819
663
  };
820
664
  exports.deserializeAws_restJson1CreateOrderCommand = deserializeAws_restJson1CreateOrderCommand;
821
665
  const deserializeAws_restJson1CreateOrderCommandError = async (output, context) => {
@@ -823,7 +667,6 @@ const deserializeAws_restJson1CreateOrderCommandError = async (output, context)
823
667
  ...output,
824
668
  body: await parseBody(output.body, context),
825
669
  };
826
- let response;
827
670
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
828
671
  switch (errorCode) {
829
672
  case "AccessDeniedException":
@@ -846,29 +689,26 @@ const deserializeAws_restJson1CreateOrderCommandError = async (output, context)
846
689
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
847
690
  default:
848
691
  const parsedBody = parsedOutput.body;
849
- const $metadata = deserializeMetadata(output);
850
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
851
- response = new OutpostsServiceException_1.OutpostsServiceException({
852
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
853
- $fault: "client",
854
- $metadata,
692
+ (0, smithy_client_1.throwDefaultError)({
693
+ output,
694
+ parsedBody,
695
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
696
+ errorCode,
855
697
  });
856
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
857
698
  }
858
699
  };
859
700
  const deserializeAws_restJson1CreateOutpostCommand = async (output, context) => {
860
701
  if (output.statusCode !== 200 && output.statusCode >= 300) {
861
702
  return deserializeAws_restJson1CreateOutpostCommandError(output, context);
862
703
  }
863
- const contents = {
704
+ const contents = map({
864
705
  $metadata: deserializeMetadata(output),
865
- Outpost: undefined,
866
- };
706
+ });
867
707
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
868
- if (data.Outpost !== undefined && data.Outpost !== null) {
708
+ if (data.Outpost != null) {
869
709
  contents.Outpost = deserializeAws_restJson1Outpost(data.Outpost, context);
870
710
  }
871
- return Promise.resolve(contents);
711
+ return contents;
872
712
  };
873
713
  exports.deserializeAws_restJson1CreateOutpostCommand = deserializeAws_restJson1CreateOutpostCommand;
874
714
  const deserializeAws_restJson1CreateOutpostCommandError = async (output, context) => {
@@ -876,7 +716,6 @@ const deserializeAws_restJson1CreateOutpostCommandError = async (output, context
876
716
  ...output,
877
717
  body: await parseBody(output.body, context),
878
718
  };
879
- let response;
880
719
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
881
720
  switch (errorCode) {
882
721
  case "AccessDeniedException":
@@ -899,29 +738,26 @@ const deserializeAws_restJson1CreateOutpostCommandError = async (output, context
899
738
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
900
739
  default:
901
740
  const parsedBody = parsedOutput.body;
902
- const $metadata = deserializeMetadata(output);
903
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
904
- response = new OutpostsServiceException_1.OutpostsServiceException({
905
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
906
- $fault: "client",
907
- $metadata,
741
+ (0, smithy_client_1.throwDefaultError)({
742
+ output,
743
+ parsedBody,
744
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
745
+ errorCode,
908
746
  });
909
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
910
747
  }
911
748
  };
912
749
  const deserializeAws_restJson1CreateSiteCommand = async (output, context) => {
913
750
  if (output.statusCode !== 200 && output.statusCode >= 300) {
914
751
  return deserializeAws_restJson1CreateSiteCommandError(output, context);
915
752
  }
916
- const contents = {
753
+ const contents = map({
917
754
  $metadata: deserializeMetadata(output),
918
- Site: undefined,
919
- };
755
+ });
920
756
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
921
- if (data.Site !== undefined && data.Site !== null) {
757
+ if (data.Site != null) {
922
758
  contents.Site = deserializeAws_restJson1Site(data.Site, context);
923
759
  }
924
- return Promise.resolve(contents);
760
+ return contents;
925
761
  };
926
762
  exports.deserializeAws_restJson1CreateSiteCommand = deserializeAws_restJson1CreateSiteCommand;
927
763
  const deserializeAws_restJson1CreateSiteCommandError = async (output, context) => {
@@ -929,7 +765,6 @@ const deserializeAws_restJson1CreateSiteCommandError = async (output, context) =
929
765
  ...output,
930
766
  body: await parseBody(output.body, context),
931
767
  };
932
- let response;
933
768
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
934
769
  switch (errorCode) {
935
770
  case "AccessDeniedException":
@@ -949,25 +784,23 @@ const deserializeAws_restJson1CreateSiteCommandError = async (output, context) =
949
784
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
950
785
  default:
951
786
  const parsedBody = parsedOutput.body;
952
- const $metadata = deserializeMetadata(output);
953
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
954
- response = new OutpostsServiceException_1.OutpostsServiceException({
955
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
956
- $fault: "client",
957
- $metadata,
787
+ (0, smithy_client_1.throwDefaultError)({
788
+ output,
789
+ parsedBody,
790
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
791
+ errorCode,
958
792
  });
959
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
960
793
  }
961
794
  };
962
795
  const deserializeAws_restJson1DeleteOutpostCommand = async (output, context) => {
963
796
  if (output.statusCode !== 200 && output.statusCode >= 300) {
964
797
  return deserializeAws_restJson1DeleteOutpostCommandError(output, context);
965
798
  }
966
- const contents = {
799
+ const contents = map({
967
800
  $metadata: deserializeMetadata(output),
968
- };
801
+ });
969
802
  await collectBody(output.body, context);
970
- return Promise.resolve(contents);
803
+ return contents;
971
804
  };
972
805
  exports.deserializeAws_restJson1DeleteOutpostCommand = deserializeAws_restJson1DeleteOutpostCommand;
973
806
  const deserializeAws_restJson1DeleteOutpostCommandError = async (output, context) => {
@@ -975,7 +808,6 @@ const deserializeAws_restJson1DeleteOutpostCommandError = async (output, context
975
808
  ...output,
976
809
  body: await parseBody(output.body, context),
977
810
  };
978
- let response;
979
811
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
980
812
  switch (errorCode) {
981
813
  case "AccessDeniedException":
@@ -995,25 +827,23 @@ const deserializeAws_restJson1DeleteOutpostCommandError = async (output, context
995
827
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
996
828
  default:
997
829
  const parsedBody = parsedOutput.body;
998
- const $metadata = deserializeMetadata(output);
999
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1000
- response = new OutpostsServiceException_1.OutpostsServiceException({
1001
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1002
- $fault: "client",
1003
- $metadata,
830
+ (0, smithy_client_1.throwDefaultError)({
831
+ output,
832
+ parsedBody,
833
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
834
+ errorCode,
1004
835
  });
1005
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1006
836
  }
1007
837
  };
1008
838
  const deserializeAws_restJson1DeleteSiteCommand = async (output, context) => {
1009
839
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1010
840
  return deserializeAws_restJson1DeleteSiteCommandError(output, context);
1011
841
  }
1012
- const contents = {
842
+ const contents = map({
1013
843
  $metadata: deserializeMetadata(output),
1014
- };
844
+ });
1015
845
  await collectBody(output.body, context);
1016
- return Promise.resolve(contents);
846
+ return contents;
1017
847
  };
1018
848
  exports.deserializeAws_restJson1DeleteSiteCommand = deserializeAws_restJson1DeleteSiteCommand;
1019
849
  const deserializeAws_restJson1DeleteSiteCommandError = async (output, context) => {
@@ -1021,7 +851,6 @@ const deserializeAws_restJson1DeleteSiteCommandError = async (output, context) =
1021
851
  ...output,
1022
852
  body: await parseBody(output.body, context),
1023
853
  };
1024
- let response;
1025
854
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1026
855
  switch (errorCode) {
1027
856
  case "AccessDeniedException":
@@ -1041,29 +870,26 @@ const deserializeAws_restJson1DeleteSiteCommandError = async (output, context) =
1041
870
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1042
871
  default:
1043
872
  const parsedBody = parsedOutput.body;
1044
- const $metadata = deserializeMetadata(output);
1045
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1046
- response = new OutpostsServiceException_1.OutpostsServiceException({
1047
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1048
- $fault: "client",
1049
- $metadata,
873
+ (0, smithy_client_1.throwDefaultError)({
874
+ output,
875
+ parsedBody,
876
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
877
+ errorCode,
1050
878
  });
1051
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1052
879
  }
1053
880
  };
1054
881
  const deserializeAws_restJson1GetCatalogItemCommand = async (output, context) => {
1055
882
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1056
883
  return deserializeAws_restJson1GetCatalogItemCommandError(output, context);
1057
884
  }
1058
- const contents = {
885
+ const contents = map({
1059
886
  $metadata: deserializeMetadata(output),
1060
- CatalogItem: undefined,
1061
- };
887
+ });
1062
888
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1063
- if (data.CatalogItem !== undefined && data.CatalogItem !== null) {
889
+ if (data.CatalogItem != null) {
1064
890
  contents.CatalogItem = deserializeAws_restJson1CatalogItem(data.CatalogItem, context);
1065
891
  }
1066
- return Promise.resolve(contents);
892
+ return contents;
1067
893
  };
1068
894
  exports.deserializeAws_restJson1GetCatalogItemCommand = deserializeAws_restJson1GetCatalogItemCommand;
1069
895
  const deserializeAws_restJson1GetCatalogItemCommandError = async (output, context) => {
@@ -1071,7 +897,6 @@ const deserializeAws_restJson1GetCatalogItemCommandError = async (output, contex
1071
897
  ...output,
1072
898
  body: await parseBody(output.body, context),
1073
899
  };
1074
- let response;
1075
900
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1076
901
  switch (errorCode) {
1077
902
  case "InternalServerException":
@@ -1085,33 +910,29 @@ const deserializeAws_restJson1GetCatalogItemCommandError = async (output, contex
1085
910
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1086
911
  default:
1087
912
  const parsedBody = parsedOutput.body;
1088
- const $metadata = deserializeMetadata(output);
1089
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1090
- response = new OutpostsServiceException_1.OutpostsServiceException({
1091
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1092
- $fault: "client",
1093
- $metadata,
913
+ (0, smithy_client_1.throwDefaultError)({
914
+ output,
915
+ parsedBody,
916
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
917
+ errorCode,
1094
918
  });
1095
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1096
919
  }
1097
920
  };
1098
921
  const deserializeAws_restJson1GetConnectionCommand = async (output, context) => {
1099
922
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1100
923
  return deserializeAws_restJson1GetConnectionCommandError(output, context);
1101
924
  }
1102
- const contents = {
925
+ const contents = map({
1103
926
  $metadata: deserializeMetadata(output),
1104
- ConnectionDetails: undefined,
1105
- ConnectionId: undefined,
1106
- };
927
+ });
1107
928
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1108
- if (data.ConnectionDetails !== undefined && data.ConnectionDetails !== null) {
929
+ if (data.ConnectionDetails != null) {
1109
930
  contents.ConnectionDetails = deserializeAws_restJson1ConnectionDetails(data.ConnectionDetails, context);
1110
931
  }
1111
- if (data.ConnectionId !== undefined && data.ConnectionId !== null) {
932
+ if (data.ConnectionId != null) {
1112
933
  contents.ConnectionId = (0, smithy_client_1.expectString)(data.ConnectionId);
1113
934
  }
1114
- return Promise.resolve(contents);
935
+ return contents;
1115
936
  };
1116
937
  exports.deserializeAws_restJson1GetConnectionCommand = deserializeAws_restJson1GetConnectionCommand;
1117
938
  const deserializeAws_restJson1GetConnectionCommandError = async (output, context) => {
@@ -1119,7 +940,6 @@ const deserializeAws_restJson1GetConnectionCommandError = async (output, context
1119
940
  ...output,
1120
941
  body: await parseBody(output.body, context),
1121
942
  };
1122
- let response;
1123
943
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1124
944
  switch (errorCode) {
1125
945
  case "AccessDeniedException":
@@ -1136,29 +956,26 @@ const deserializeAws_restJson1GetConnectionCommandError = async (output, context
1136
956
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1137
957
  default:
1138
958
  const parsedBody = parsedOutput.body;
1139
- const $metadata = deserializeMetadata(output);
1140
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1141
- response = new OutpostsServiceException_1.OutpostsServiceException({
1142
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1143
- $fault: "client",
1144
- $metadata,
959
+ (0, smithy_client_1.throwDefaultError)({
960
+ output,
961
+ parsedBody,
962
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
963
+ errorCode,
1145
964
  });
1146
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1147
965
  }
1148
966
  };
1149
967
  const deserializeAws_restJson1GetOrderCommand = async (output, context) => {
1150
968
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1151
969
  return deserializeAws_restJson1GetOrderCommandError(output, context);
1152
970
  }
1153
- const contents = {
971
+ const contents = map({
1154
972
  $metadata: deserializeMetadata(output),
1155
- Order: undefined,
1156
- };
973
+ });
1157
974
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1158
- if (data.Order !== undefined && data.Order !== null) {
975
+ if (data.Order != null) {
1159
976
  contents.Order = deserializeAws_restJson1Order(data.Order, context);
1160
977
  }
1161
- return Promise.resolve(contents);
978
+ return contents;
1162
979
  };
1163
980
  exports.deserializeAws_restJson1GetOrderCommand = deserializeAws_restJson1GetOrderCommand;
1164
981
  const deserializeAws_restJson1GetOrderCommandError = async (output, context) => {
@@ -1166,7 +983,6 @@ const deserializeAws_restJson1GetOrderCommandError = async (output, context) =>
1166
983
  ...output,
1167
984
  body: await parseBody(output.body, context),
1168
985
  };
1169
- let response;
1170
986
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1171
987
  switch (errorCode) {
1172
988
  case "InternalServerException":
@@ -1180,29 +996,26 @@ const deserializeAws_restJson1GetOrderCommandError = async (output, context) =>
1180
996
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1181
997
  default:
1182
998
  const parsedBody = parsedOutput.body;
1183
- const $metadata = deserializeMetadata(output);
1184
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1185
- response = new OutpostsServiceException_1.OutpostsServiceException({
1186
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1187
- $fault: "client",
1188
- $metadata,
999
+ (0, smithy_client_1.throwDefaultError)({
1000
+ output,
1001
+ parsedBody,
1002
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1003
+ errorCode,
1189
1004
  });
1190
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1191
1005
  }
1192
1006
  };
1193
1007
  const deserializeAws_restJson1GetOutpostCommand = async (output, context) => {
1194
1008
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1195
1009
  return deserializeAws_restJson1GetOutpostCommandError(output, context);
1196
1010
  }
1197
- const contents = {
1011
+ const contents = map({
1198
1012
  $metadata: deserializeMetadata(output),
1199
- Outpost: undefined,
1200
- };
1013
+ });
1201
1014
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1202
- if (data.Outpost !== undefined && data.Outpost !== null) {
1015
+ if (data.Outpost != null) {
1203
1016
  contents.Outpost = deserializeAws_restJson1Outpost(data.Outpost, context);
1204
1017
  }
1205
- return Promise.resolve(contents);
1018
+ return contents;
1206
1019
  };
1207
1020
  exports.deserializeAws_restJson1GetOutpostCommand = deserializeAws_restJson1GetOutpostCommand;
1208
1021
  const deserializeAws_restJson1GetOutpostCommandError = async (output, context) => {
@@ -1210,7 +1023,6 @@ const deserializeAws_restJson1GetOutpostCommandError = async (output, context) =
1210
1023
  ...output,
1211
1024
  body: await parseBody(output.body, context),
1212
1025
  };
1213
- let response;
1214
1026
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1215
1027
  switch (errorCode) {
1216
1028
  case "AccessDeniedException":
@@ -1227,41 +1039,35 @@ const deserializeAws_restJson1GetOutpostCommandError = async (output, context) =
1227
1039
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1228
1040
  default:
1229
1041
  const parsedBody = parsedOutput.body;
1230
- const $metadata = deserializeMetadata(output);
1231
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1232
- response = new OutpostsServiceException_1.OutpostsServiceException({
1233
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1234
- $fault: "client",
1235
- $metadata,
1042
+ (0, smithy_client_1.throwDefaultError)({
1043
+ output,
1044
+ parsedBody,
1045
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1046
+ errorCode,
1236
1047
  });
1237
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1238
1048
  }
1239
1049
  };
1240
1050
  const deserializeAws_restJson1GetOutpostInstanceTypesCommand = async (output, context) => {
1241
1051
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1242
1052
  return deserializeAws_restJson1GetOutpostInstanceTypesCommandError(output, context);
1243
1053
  }
1244
- const contents = {
1054
+ const contents = map({
1245
1055
  $metadata: deserializeMetadata(output),
1246
- InstanceTypes: undefined,
1247
- NextToken: undefined,
1248
- OutpostArn: undefined,
1249
- OutpostId: undefined,
1250
- };
1056
+ });
1251
1057
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1252
- if (data.InstanceTypes !== undefined && data.InstanceTypes !== null) {
1058
+ if (data.InstanceTypes != null) {
1253
1059
  contents.InstanceTypes = deserializeAws_restJson1InstanceTypeListDefinition(data.InstanceTypes, context);
1254
1060
  }
1255
- if (data.NextToken !== undefined && data.NextToken !== null) {
1061
+ if (data.NextToken != null) {
1256
1062
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1257
1063
  }
1258
- if (data.OutpostArn !== undefined && data.OutpostArn !== null) {
1064
+ if (data.OutpostArn != null) {
1259
1065
  contents.OutpostArn = (0, smithy_client_1.expectString)(data.OutpostArn);
1260
1066
  }
1261
- if (data.OutpostId !== undefined && data.OutpostId !== null) {
1067
+ if (data.OutpostId != null) {
1262
1068
  contents.OutpostId = (0, smithy_client_1.expectString)(data.OutpostId);
1263
1069
  }
1264
- return Promise.resolve(contents);
1070
+ return contents;
1265
1071
  };
1266
1072
  exports.deserializeAws_restJson1GetOutpostInstanceTypesCommand = deserializeAws_restJson1GetOutpostInstanceTypesCommand;
1267
1073
  const deserializeAws_restJson1GetOutpostInstanceTypesCommandError = async (output, context) => {
@@ -1269,7 +1075,6 @@ const deserializeAws_restJson1GetOutpostInstanceTypesCommandError = async (outpu
1269
1075
  ...output,
1270
1076
  body: await parseBody(output.body, context),
1271
1077
  };
1272
- let response;
1273
1078
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1274
1079
  switch (errorCode) {
1275
1080
  case "AccessDeniedException":
@@ -1286,29 +1091,26 @@ const deserializeAws_restJson1GetOutpostInstanceTypesCommandError = async (outpu
1286
1091
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1287
1092
  default:
1288
1093
  const parsedBody = parsedOutput.body;
1289
- const $metadata = deserializeMetadata(output);
1290
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1291
- response = new OutpostsServiceException_1.OutpostsServiceException({
1292
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1293
- $fault: "client",
1294
- $metadata,
1094
+ (0, smithy_client_1.throwDefaultError)({
1095
+ output,
1096
+ parsedBody,
1097
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1098
+ errorCode,
1295
1099
  });
1296
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1297
1100
  }
1298
1101
  };
1299
1102
  const deserializeAws_restJson1GetSiteCommand = async (output, context) => {
1300
1103
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1301
1104
  return deserializeAws_restJson1GetSiteCommandError(output, context);
1302
1105
  }
1303
- const contents = {
1106
+ const contents = map({
1304
1107
  $metadata: deserializeMetadata(output),
1305
- Site: undefined,
1306
- };
1108
+ });
1307
1109
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1308
- if (data.Site !== undefined && data.Site !== null) {
1110
+ if (data.Site != null) {
1309
1111
  contents.Site = deserializeAws_restJson1Site(data.Site, context);
1310
1112
  }
1311
- return Promise.resolve(contents);
1113
+ return contents;
1312
1114
  };
1313
1115
  exports.deserializeAws_restJson1GetSiteCommand = deserializeAws_restJson1GetSiteCommand;
1314
1116
  const deserializeAws_restJson1GetSiteCommandError = async (output, context) => {
@@ -1316,7 +1118,6 @@ const deserializeAws_restJson1GetSiteCommandError = async (output, context) => {
1316
1118
  ...output,
1317
1119
  body: await parseBody(output.body, context),
1318
1120
  };
1319
- let response;
1320
1121
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1321
1122
  switch (errorCode) {
1322
1123
  case "AccessDeniedException":
@@ -1333,37 +1134,32 @@ const deserializeAws_restJson1GetSiteCommandError = async (output, context) => {
1333
1134
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1334
1135
  default:
1335
1136
  const parsedBody = parsedOutput.body;
1336
- const $metadata = deserializeMetadata(output);
1337
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1338
- response = new OutpostsServiceException_1.OutpostsServiceException({
1339
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1340
- $fault: "client",
1341
- $metadata,
1137
+ (0, smithy_client_1.throwDefaultError)({
1138
+ output,
1139
+ parsedBody,
1140
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1141
+ errorCode,
1342
1142
  });
1343
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1344
1143
  }
1345
1144
  };
1346
1145
  const deserializeAws_restJson1GetSiteAddressCommand = async (output, context) => {
1347
1146
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1348
1147
  return deserializeAws_restJson1GetSiteAddressCommandError(output, context);
1349
1148
  }
1350
- const contents = {
1149
+ const contents = map({
1351
1150
  $metadata: deserializeMetadata(output),
1352
- Address: undefined,
1353
- AddressType: undefined,
1354
- SiteId: undefined,
1355
- };
1151
+ });
1356
1152
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1357
- if (data.Address !== undefined && data.Address !== null) {
1153
+ if (data.Address != null) {
1358
1154
  contents.Address = deserializeAws_restJson1Address(data.Address, context);
1359
1155
  }
1360
- if (data.AddressType !== undefined && data.AddressType !== null) {
1156
+ if (data.AddressType != null) {
1361
1157
  contents.AddressType = (0, smithy_client_1.expectString)(data.AddressType);
1362
1158
  }
1363
- if (data.SiteId !== undefined && data.SiteId !== null) {
1159
+ if (data.SiteId != null) {
1364
1160
  contents.SiteId = (0, smithy_client_1.expectString)(data.SiteId);
1365
1161
  }
1366
- return Promise.resolve(contents);
1162
+ return contents;
1367
1163
  };
1368
1164
  exports.deserializeAws_restJson1GetSiteAddressCommand = deserializeAws_restJson1GetSiteAddressCommand;
1369
1165
  const deserializeAws_restJson1GetSiteAddressCommandError = async (output, context) => {
@@ -1371,7 +1167,6 @@ const deserializeAws_restJson1GetSiteAddressCommandError = async (output, contex
1371
1167
  ...output,
1372
1168
  body: await parseBody(output.body, context),
1373
1169
  };
1374
- let response;
1375
1170
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1376
1171
  switch (errorCode) {
1377
1172
  case "AccessDeniedException":
@@ -1388,33 +1183,29 @@ const deserializeAws_restJson1GetSiteAddressCommandError = async (output, contex
1388
1183
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1389
1184
  default:
1390
1185
  const parsedBody = parsedOutput.body;
1391
- const $metadata = deserializeMetadata(output);
1392
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1393
- response = new OutpostsServiceException_1.OutpostsServiceException({
1394
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1395
- $fault: "client",
1396
- $metadata,
1186
+ (0, smithy_client_1.throwDefaultError)({
1187
+ output,
1188
+ parsedBody,
1189
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1190
+ errorCode,
1397
1191
  });
1398
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1399
1192
  }
1400
1193
  };
1401
1194
  const deserializeAws_restJson1ListAssetsCommand = async (output, context) => {
1402
1195
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1403
1196
  return deserializeAws_restJson1ListAssetsCommandError(output, context);
1404
1197
  }
1405
- const contents = {
1198
+ const contents = map({
1406
1199
  $metadata: deserializeMetadata(output),
1407
- Assets: undefined,
1408
- NextToken: undefined,
1409
- };
1200
+ });
1410
1201
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1411
- if (data.Assets !== undefined && data.Assets !== null) {
1202
+ if (data.Assets != null) {
1412
1203
  contents.Assets = deserializeAws_restJson1AssetListDefinition(data.Assets, context);
1413
1204
  }
1414
- if (data.NextToken !== undefined && data.NextToken !== null) {
1205
+ if (data.NextToken != null) {
1415
1206
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1416
1207
  }
1417
- return Promise.resolve(contents);
1208
+ return contents;
1418
1209
  };
1419
1210
  exports.deserializeAws_restJson1ListAssetsCommand = deserializeAws_restJson1ListAssetsCommand;
1420
1211
  const deserializeAws_restJson1ListAssetsCommandError = async (output, context) => {
@@ -1422,7 +1213,6 @@ const deserializeAws_restJson1ListAssetsCommandError = async (output, context) =
1422
1213
  ...output,
1423
1214
  body: await parseBody(output.body, context),
1424
1215
  };
1425
- let response;
1426
1216
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1427
1217
  switch (errorCode) {
1428
1218
  case "AccessDeniedException":
@@ -1439,33 +1229,29 @@ const deserializeAws_restJson1ListAssetsCommandError = async (output, context) =
1439
1229
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1440
1230
  default:
1441
1231
  const parsedBody = parsedOutput.body;
1442
- const $metadata = deserializeMetadata(output);
1443
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1444
- response = new OutpostsServiceException_1.OutpostsServiceException({
1445
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1446
- $fault: "client",
1447
- $metadata,
1232
+ (0, smithy_client_1.throwDefaultError)({
1233
+ output,
1234
+ parsedBody,
1235
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1236
+ errorCode,
1448
1237
  });
1449
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1450
1238
  }
1451
1239
  };
1452
1240
  const deserializeAws_restJson1ListCatalogItemsCommand = async (output, context) => {
1453
1241
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1454
1242
  return deserializeAws_restJson1ListCatalogItemsCommandError(output, context);
1455
1243
  }
1456
- const contents = {
1244
+ const contents = map({
1457
1245
  $metadata: deserializeMetadata(output),
1458
- CatalogItems: undefined,
1459
- NextToken: undefined,
1460
- };
1246
+ });
1461
1247
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1462
- if (data.CatalogItems !== undefined && data.CatalogItems !== null) {
1248
+ if (data.CatalogItems != null) {
1463
1249
  contents.CatalogItems = deserializeAws_restJson1CatalogItemListDefinition(data.CatalogItems, context);
1464
1250
  }
1465
- if (data.NextToken !== undefined && data.NextToken !== null) {
1251
+ if (data.NextToken != null) {
1466
1252
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1467
1253
  }
1468
- return Promise.resolve(contents);
1254
+ return contents;
1469
1255
  };
1470
1256
  exports.deserializeAws_restJson1ListCatalogItemsCommand = deserializeAws_restJson1ListCatalogItemsCommand;
1471
1257
  const deserializeAws_restJson1ListCatalogItemsCommandError = async (output, context) => {
@@ -1473,7 +1259,6 @@ const deserializeAws_restJson1ListCatalogItemsCommandError = async (output, cont
1473
1259
  ...output,
1474
1260
  body: await parseBody(output.body, context),
1475
1261
  };
1476
- let response;
1477
1262
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1478
1263
  switch (errorCode) {
1479
1264
  case "InternalServerException":
@@ -1487,33 +1272,29 @@ const deserializeAws_restJson1ListCatalogItemsCommandError = async (output, cont
1487
1272
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1488
1273
  default:
1489
1274
  const parsedBody = parsedOutput.body;
1490
- const $metadata = deserializeMetadata(output);
1491
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1492
- response = new OutpostsServiceException_1.OutpostsServiceException({
1493
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1494
- $fault: "client",
1495
- $metadata,
1275
+ (0, smithy_client_1.throwDefaultError)({
1276
+ output,
1277
+ parsedBody,
1278
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1279
+ errorCode,
1496
1280
  });
1497
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1498
1281
  }
1499
1282
  };
1500
1283
  const deserializeAws_restJson1ListOrdersCommand = async (output, context) => {
1501
1284
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1502
1285
  return deserializeAws_restJson1ListOrdersCommandError(output, context);
1503
1286
  }
1504
- const contents = {
1287
+ const contents = map({
1505
1288
  $metadata: deserializeMetadata(output),
1506
- NextToken: undefined,
1507
- Orders: undefined,
1508
- };
1289
+ });
1509
1290
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1510
- if (data.NextToken !== undefined && data.NextToken !== null) {
1291
+ if (data.NextToken != null) {
1511
1292
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1512
1293
  }
1513
- if (data.Orders !== undefined && data.Orders !== null) {
1294
+ if (data.Orders != null) {
1514
1295
  contents.Orders = deserializeAws_restJson1OrderSummaryListDefinition(data.Orders, context);
1515
1296
  }
1516
- return Promise.resolve(contents);
1297
+ return contents;
1517
1298
  };
1518
1299
  exports.deserializeAws_restJson1ListOrdersCommand = deserializeAws_restJson1ListOrdersCommand;
1519
1300
  const deserializeAws_restJson1ListOrdersCommandError = async (output, context) => {
@@ -1521,7 +1302,6 @@ const deserializeAws_restJson1ListOrdersCommandError = async (output, context) =
1521
1302
  ...output,
1522
1303
  body: await parseBody(output.body, context),
1523
1304
  };
1524
- let response;
1525
1305
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1526
1306
  switch (errorCode) {
1527
1307
  case "AccessDeniedException":
@@ -1538,33 +1318,29 @@ const deserializeAws_restJson1ListOrdersCommandError = async (output, context) =
1538
1318
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1539
1319
  default:
1540
1320
  const parsedBody = parsedOutput.body;
1541
- const $metadata = deserializeMetadata(output);
1542
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1543
- response = new OutpostsServiceException_1.OutpostsServiceException({
1544
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1545
- $fault: "client",
1546
- $metadata,
1321
+ (0, smithy_client_1.throwDefaultError)({
1322
+ output,
1323
+ parsedBody,
1324
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1325
+ errorCode,
1547
1326
  });
1548
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1549
1327
  }
1550
1328
  };
1551
1329
  const deserializeAws_restJson1ListOutpostsCommand = async (output, context) => {
1552
1330
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1553
1331
  return deserializeAws_restJson1ListOutpostsCommandError(output, context);
1554
1332
  }
1555
- const contents = {
1333
+ const contents = map({
1556
1334
  $metadata: deserializeMetadata(output),
1557
- NextToken: undefined,
1558
- Outposts: undefined,
1559
- };
1335
+ });
1560
1336
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1561
- if (data.NextToken !== undefined && data.NextToken !== null) {
1337
+ if (data.NextToken != null) {
1562
1338
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1563
1339
  }
1564
- if (data.Outposts !== undefined && data.Outposts !== null) {
1340
+ if (data.Outposts != null) {
1565
1341
  contents.Outposts = deserializeAws_restJson1outpostListDefinition(data.Outposts, context);
1566
1342
  }
1567
- return Promise.resolve(contents);
1343
+ return contents;
1568
1344
  };
1569
1345
  exports.deserializeAws_restJson1ListOutpostsCommand = deserializeAws_restJson1ListOutpostsCommand;
1570
1346
  const deserializeAws_restJson1ListOutpostsCommandError = async (output, context) => {
@@ -1572,7 +1348,6 @@ const deserializeAws_restJson1ListOutpostsCommandError = async (output, context)
1572
1348
  ...output,
1573
1349
  body: await parseBody(output.body, context),
1574
1350
  };
1575
- let response;
1576
1351
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1577
1352
  switch (errorCode) {
1578
1353
  case "AccessDeniedException":
@@ -1586,33 +1361,29 @@ const deserializeAws_restJson1ListOutpostsCommandError = async (output, context)
1586
1361
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1587
1362
  default:
1588
1363
  const parsedBody = parsedOutput.body;
1589
- const $metadata = deserializeMetadata(output);
1590
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1591
- response = new OutpostsServiceException_1.OutpostsServiceException({
1592
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1593
- $fault: "client",
1594
- $metadata,
1364
+ (0, smithy_client_1.throwDefaultError)({
1365
+ output,
1366
+ parsedBody,
1367
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1368
+ errorCode,
1595
1369
  });
1596
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1597
1370
  }
1598
1371
  };
1599
1372
  const deserializeAws_restJson1ListSitesCommand = async (output, context) => {
1600
1373
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1601
1374
  return deserializeAws_restJson1ListSitesCommandError(output, context);
1602
1375
  }
1603
- const contents = {
1376
+ const contents = map({
1604
1377
  $metadata: deserializeMetadata(output),
1605
- NextToken: undefined,
1606
- Sites: undefined,
1607
- };
1378
+ });
1608
1379
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1609
- if (data.NextToken !== undefined && data.NextToken !== null) {
1380
+ if (data.NextToken != null) {
1610
1381
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1611
1382
  }
1612
- if (data.Sites !== undefined && data.Sites !== null) {
1383
+ if (data.Sites != null) {
1613
1384
  contents.Sites = deserializeAws_restJson1siteListDefinition(data.Sites, context);
1614
1385
  }
1615
- return Promise.resolve(contents);
1386
+ return contents;
1616
1387
  };
1617
1388
  exports.deserializeAws_restJson1ListSitesCommand = deserializeAws_restJson1ListSitesCommand;
1618
1389
  const deserializeAws_restJson1ListSitesCommandError = async (output, context) => {
@@ -1620,7 +1391,6 @@ const deserializeAws_restJson1ListSitesCommandError = async (output, context) =>
1620
1391
  ...output,
1621
1392
  body: await parseBody(output.body, context),
1622
1393
  };
1623
- let response;
1624
1394
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1625
1395
  switch (errorCode) {
1626
1396
  case "AccessDeniedException":
@@ -1634,29 +1404,26 @@ const deserializeAws_restJson1ListSitesCommandError = async (output, context) =>
1634
1404
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1635
1405
  default:
1636
1406
  const parsedBody = parsedOutput.body;
1637
- const $metadata = deserializeMetadata(output);
1638
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1639
- response = new OutpostsServiceException_1.OutpostsServiceException({
1640
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1641
- $fault: "client",
1642
- $metadata,
1407
+ (0, smithy_client_1.throwDefaultError)({
1408
+ output,
1409
+ parsedBody,
1410
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1411
+ errorCode,
1643
1412
  });
1644
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1645
1413
  }
1646
1414
  };
1647
1415
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1648
1416
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1649
1417
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1650
1418
  }
1651
- const contents = {
1419
+ const contents = map({
1652
1420
  $metadata: deserializeMetadata(output),
1653
- Tags: undefined,
1654
- };
1421
+ });
1655
1422
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1656
- if (data.Tags !== undefined && data.Tags !== null) {
1423
+ if (data.Tags != null) {
1657
1424
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
1658
1425
  }
1659
- return Promise.resolve(contents);
1426
+ return contents;
1660
1427
  };
1661
1428
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1662
1429
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1664,7 +1431,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1664
1431
  ...output,
1665
1432
  body: await parseBody(output.body, context),
1666
1433
  };
1667
- let response;
1668
1434
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1669
1435
  switch (errorCode) {
1670
1436
  case "InternalServerException":
@@ -1678,33 +1444,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1678
1444
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1679
1445
  default:
1680
1446
  const parsedBody = parsedOutput.body;
1681
- const $metadata = deserializeMetadata(output);
1682
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1683
- response = new OutpostsServiceException_1.OutpostsServiceException({
1684
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1685
- $fault: "client",
1686
- $metadata,
1447
+ (0, smithy_client_1.throwDefaultError)({
1448
+ output,
1449
+ parsedBody,
1450
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1451
+ errorCode,
1687
1452
  });
1688
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1689
1453
  }
1690
1454
  };
1691
1455
  const deserializeAws_restJson1StartConnectionCommand = async (output, context) => {
1692
1456
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1693
1457
  return deserializeAws_restJson1StartConnectionCommandError(output, context);
1694
1458
  }
1695
- const contents = {
1459
+ const contents = map({
1696
1460
  $metadata: deserializeMetadata(output),
1697
- ConnectionId: undefined,
1698
- UnderlayIpAddress: undefined,
1699
- };
1461
+ });
1700
1462
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1701
- if (data.ConnectionId !== undefined && data.ConnectionId !== null) {
1463
+ if (data.ConnectionId != null) {
1702
1464
  contents.ConnectionId = (0, smithy_client_1.expectString)(data.ConnectionId);
1703
1465
  }
1704
- if (data.UnderlayIpAddress !== undefined && data.UnderlayIpAddress !== null) {
1466
+ if (data.UnderlayIpAddress != null) {
1705
1467
  contents.UnderlayIpAddress = (0, smithy_client_1.expectString)(data.UnderlayIpAddress);
1706
1468
  }
1707
- return Promise.resolve(contents);
1469
+ return contents;
1708
1470
  };
1709
1471
  exports.deserializeAws_restJson1StartConnectionCommand = deserializeAws_restJson1StartConnectionCommand;
1710
1472
  const deserializeAws_restJson1StartConnectionCommandError = async (output, context) => {
@@ -1712,7 +1474,6 @@ const deserializeAws_restJson1StartConnectionCommandError = async (output, conte
1712
1474
  ...output,
1713
1475
  body: await parseBody(output.body, context),
1714
1476
  };
1715
- let response;
1716
1477
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1717
1478
  switch (errorCode) {
1718
1479
  case "AccessDeniedException":
@@ -1729,25 +1490,23 @@ const deserializeAws_restJson1StartConnectionCommandError = async (output, conte
1729
1490
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1730
1491
  default:
1731
1492
  const parsedBody = parsedOutput.body;
1732
- const $metadata = deserializeMetadata(output);
1733
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1734
- response = new OutpostsServiceException_1.OutpostsServiceException({
1735
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1736
- $fault: "client",
1737
- $metadata,
1493
+ (0, smithy_client_1.throwDefaultError)({
1494
+ output,
1495
+ parsedBody,
1496
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1497
+ errorCode,
1738
1498
  });
1739
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1740
1499
  }
1741
1500
  };
1742
1501
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1743
1502
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1744
1503
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1745
1504
  }
1746
- const contents = {
1505
+ const contents = map({
1747
1506
  $metadata: deserializeMetadata(output),
1748
- };
1507
+ });
1749
1508
  await collectBody(output.body, context);
1750
- return Promise.resolve(contents);
1509
+ return contents;
1751
1510
  };
1752
1511
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1753
1512
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1755,7 +1514,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1755
1514
  ...output,
1756
1515
  body: await parseBody(output.body, context),
1757
1516
  };
1758
- let response;
1759
1517
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1760
1518
  switch (errorCode) {
1761
1519
  case "InternalServerException":
@@ -1769,25 +1527,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1769
1527
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1770
1528
  default:
1771
1529
  const parsedBody = parsedOutput.body;
1772
- const $metadata = deserializeMetadata(output);
1773
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1774
- response = new OutpostsServiceException_1.OutpostsServiceException({
1775
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1776
- $fault: "client",
1777
- $metadata,
1530
+ (0, smithy_client_1.throwDefaultError)({
1531
+ output,
1532
+ parsedBody,
1533
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1534
+ errorCode,
1778
1535
  });
1779
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1780
1536
  }
1781
1537
  };
1782
1538
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1783
1539
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1784
1540
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1785
1541
  }
1786
- const contents = {
1542
+ const contents = map({
1787
1543
  $metadata: deserializeMetadata(output),
1788
- };
1544
+ });
1789
1545
  await collectBody(output.body, context);
1790
- return Promise.resolve(contents);
1546
+ return contents;
1791
1547
  };
1792
1548
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1793
1549
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1795,7 +1551,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1795
1551
  ...output,
1796
1552
  body: await parseBody(output.body, context),
1797
1553
  };
1798
- let response;
1799
1554
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1800
1555
  switch (errorCode) {
1801
1556
  case "InternalServerException":
@@ -1809,29 +1564,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1809
1564
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1810
1565
  default:
1811
1566
  const parsedBody = parsedOutput.body;
1812
- const $metadata = deserializeMetadata(output);
1813
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1814
- response = new OutpostsServiceException_1.OutpostsServiceException({
1815
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1816
- $fault: "client",
1817
- $metadata,
1567
+ (0, smithy_client_1.throwDefaultError)({
1568
+ output,
1569
+ parsedBody,
1570
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1571
+ errorCode,
1818
1572
  });
1819
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1820
1573
  }
1821
1574
  };
1822
1575
  const deserializeAws_restJson1UpdateOutpostCommand = async (output, context) => {
1823
1576
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1824
1577
  return deserializeAws_restJson1UpdateOutpostCommandError(output, context);
1825
1578
  }
1826
- const contents = {
1579
+ const contents = map({
1827
1580
  $metadata: deserializeMetadata(output),
1828
- Outpost: undefined,
1829
- };
1581
+ });
1830
1582
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1831
- if (data.Outpost !== undefined && data.Outpost !== null) {
1583
+ if (data.Outpost != null) {
1832
1584
  contents.Outpost = deserializeAws_restJson1Outpost(data.Outpost, context);
1833
1585
  }
1834
- return Promise.resolve(contents);
1586
+ return contents;
1835
1587
  };
1836
1588
  exports.deserializeAws_restJson1UpdateOutpostCommand = deserializeAws_restJson1UpdateOutpostCommand;
1837
1589
  const deserializeAws_restJson1UpdateOutpostCommandError = async (output, context) => {
@@ -1839,7 +1591,6 @@ const deserializeAws_restJson1UpdateOutpostCommandError = async (output, context
1839
1591
  ...output,
1840
1592
  body: await parseBody(output.body, context),
1841
1593
  };
1842
- let response;
1843
1594
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1844
1595
  switch (errorCode) {
1845
1596
  case "AccessDeniedException":
@@ -1859,29 +1610,26 @@ const deserializeAws_restJson1UpdateOutpostCommandError = async (output, context
1859
1610
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1860
1611
  default:
1861
1612
  const parsedBody = parsedOutput.body;
1862
- const $metadata = deserializeMetadata(output);
1863
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1864
- response = new OutpostsServiceException_1.OutpostsServiceException({
1865
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1866
- $fault: "client",
1867
- $metadata,
1613
+ (0, smithy_client_1.throwDefaultError)({
1614
+ output,
1615
+ parsedBody,
1616
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1617
+ errorCode,
1868
1618
  });
1869
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1870
1619
  }
1871
1620
  };
1872
1621
  const deserializeAws_restJson1UpdateSiteCommand = async (output, context) => {
1873
1622
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1874
1623
  return deserializeAws_restJson1UpdateSiteCommandError(output, context);
1875
1624
  }
1876
- const contents = {
1625
+ const contents = map({
1877
1626
  $metadata: deserializeMetadata(output),
1878
- Site: undefined,
1879
- };
1627
+ });
1880
1628
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1881
- if (data.Site !== undefined && data.Site !== null) {
1629
+ if (data.Site != null) {
1882
1630
  contents.Site = deserializeAws_restJson1Site(data.Site, context);
1883
1631
  }
1884
- return Promise.resolve(contents);
1632
+ return contents;
1885
1633
  };
1886
1634
  exports.deserializeAws_restJson1UpdateSiteCommand = deserializeAws_restJson1UpdateSiteCommand;
1887
1635
  const deserializeAws_restJson1UpdateSiteCommandError = async (output, context) => {
@@ -1889,7 +1637,6 @@ const deserializeAws_restJson1UpdateSiteCommandError = async (output, context) =
1889
1637
  ...output,
1890
1638
  body: await parseBody(output.body, context),
1891
1639
  };
1892
- let response;
1893
1640
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1894
1641
  switch (errorCode) {
1895
1642
  case "AccessDeniedException":
@@ -1909,33 +1656,29 @@ const deserializeAws_restJson1UpdateSiteCommandError = async (output, context) =
1909
1656
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1910
1657
  default:
1911
1658
  const parsedBody = parsedOutput.body;
1912
- const $metadata = deserializeMetadata(output);
1913
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1914
- response = new OutpostsServiceException_1.OutpostsServiceException({
1915
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1916
- $fault: "client",
1917
- $metadata,
1659
+ (0, smithy_client_1.throwDefaultError)({
1660
+ output,
1661
+ parsedBody,
1662
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1663
+ errorCode,
1918
1664
  });
1919
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1920
1665
  }
1921
1666
  };
1922
1667
  const deserializeAws_restJson1UpdateSiteAddressCommand = async (output, context) => {
1923
1668
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1924
1669
  return deserializeAws_restJson1UpdateSiteAddressCommandError(output, context);
1925
1670
  }
1926
- const contents = {
1671
+ const contents = map({
1927
1672
  $metadata: deserializeMetadata(output),
1928
- Address: undefined,
1929
- AddressType: undefined,
1930
- };
1673
+ });
1931
1674
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1932
- if (data.Address !== undefined && data.Address !== null) {
1675
+ if (data.Address != null) {
1933
1676
  contents.Address = deserializeAws_restJson1Address(data.Address, context);
1934
1677
  }
1935
- if (data.AddressType !== undefined && data.AddressType !== null) {
1678
+ if (data.AddressType != null) {
1936
1679
  contents.AddressType = (0, smithy_client_1.expectString)(data.AddressType);
1937
1680
  }
1938
- return Promise.resolve(contents);
1681
+ return contents;
1939
1682
  };
1940
1683
  exports.deserializeAws_restJson1UpdateSiteAddressCommand = deserializeAws_restJson1UpdateSiteAddressCommand;
1941
1684
  const deserializeAws_restJson1UpdateSiteAddressCommandError = async (output, context) => {
@@ -1943,7 +1686,6 @@ const deserializeAws_restJson1UpdateSiteAddressCommandError = async (output, con
1943
1686
  ...output,
1944
1687
  body: await parseBody(output.body, context),
1945
1688
  };
1946
- let response;
1947
1689
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1948
1690
  switch (errorCode) {
1949
1691
  case "AccessDeniedException":
@@ -1963,29 +1705,26 @@ const deserializeAws_restJson1UpdateSiteAddressCommandError = async (output, con
1963
1705
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1964
1706
  default:
1965
1707
  const parsedBody = parsedOutput.body;
1966
- const $metadata = deserializeMetadata(output);
1967
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1968
- response = new OutpostsServiceException_1.OutpostsServiceException({
1969
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1970
- $fault: "client",
1971
- $metadata,
1708
+ (0, smithy_client_1.throwDefaultError)({
1709
+ output,
1710
+ parsedBody,
1711
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1712
+ errorCode,
1972
1713
  });
1973
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1974
1714
  }
1975
1715
  };
1976
1716
  const deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommand = async (output, context) => {
1977
1717
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1978
1718
  return deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommandError(output, context);
1979
1719
  }
1980
- const contents = {
1720
+ const contents = map({
1981
1721
  $metadata: deserializeMetadata(output),
1982
- Site: undefined,
1983
- };
1722
+ });
1984
1723
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1985
- if (data.Site !== undefined && data.Site !== null) {
1724
+ if (data.Site != null) {
1986
1725
  contents.Site = deserializeAws_restJson1Site(data.Site, context);
1987
1726
  }
1988
- return Promise.resolve(contents);
1727
+ return contents;
1989
1728
  };
1990
1729
  exports.deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommand = deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommand;
1991
1730
  const deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommandError = async (output, context) => {
@@ -1993,7 +1732,6 @@ const deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommandError = asy
1993
1732
  ...output,
1994
1733
  body: await parseBody(output.body, context),
1995
1734
  };
1996
- let response;
1997
1735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1998
1736
  switch (errorCode) {
1999
1737
  case "AccessDeniedException":
@@ -2013,20 +1751,19 @@ const deserializeAws_restJson1UpdateSiteRackPhysicalPropertiesCommandError = asy
2013
1751
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2014
1752
  default:
2015
1753
  const parsedBody = parsedOutput.body;
2016
- const $metadata = deserializeMetadata(output);
2017
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2018
- response = new OutpostsServiceException_1.OutpostsServiceException({
2019
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2020
- $fault: "client",
2021
- $metadata,
1754
+ (0, smithy_client_1.throwDefaultError)({
1755
+ output,
1756
+ parsedBody,
1757
+ exceptionCtor: OutpostsServiceException_1.OutpostsServiceException,
1758
+ errorCode,
2022
1759
  });
2023
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2024
1760
  }
2025
1761
  };
1762
+ const map = smithy_client_1.map;
2026
1763
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2027
- const contents = {};
1764
+ const contents = map({});
2028
1765
  const data = parsedOutput.body;
2029
- if (data.Message !== undefined && data.Message !== null) {
1766
+ if (data.Message != null) {
2030
1767
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2031
1768
  }
2032
1769
  const exception = new models_0_1.AccessDeniedException({
@@ -2036,15 +1773,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2036
1773
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2037
1774
  };
2038
1775
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2039
- const contents = {};
1776
+ const contents = map({});
2040
1777
  const data = parsedOutput.body;
2041
- if (data.Message !== undefined && data.Message !== null) {
1778
+ if (data.Message != null) {
2042
1779
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2043
1780
  }
2044
- if (data.ResourceId !== undefined && data.ResourceId !== null) {
1781
+ if (data.ResourceId != null) {
2045
1782
  contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2046
1783
  }
2047
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
1784
+ if (data.ResourceType != null) {
2048
1785
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2049
1786
  }
2050
1787
  const exception = new models_0_1.ConflictException({
@@ -2054,9 +1791,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2054
1791
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2055
1792
  };
2056
1793
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2057
- const contents = {};
1794
+ const contents = map({});
2058
1795
  const data = parsedOutput.body;
2059
- if (data.Message !== undefined && data.Message !== null) {
1796
+ if (data.Message != null) {
2060
1797
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2061
1798
  }
2062
1799
  const exception = new models_0_1.InternalServerException({
@@ -2066,9 +1803,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2066
1803
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2067
1804
  };
2068
1805
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
2069
- const contents = {};
1806
+ const contents = map({});
2070
1807
  const data = parsedOutput.body;
2071
- if (data.Message !== undefined && data.Message !== null) {
1808
+ if (data.Message != null) {
2072
1809
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2073
1810
  }
2074
1811
  const exception = new models_0_1.NotFoundException({
@@ -2078,9 +1815,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
2078
1815
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2079
1816
  };
2080
1817
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2081
- const contents = {};
1818
+ const contents = map({});
2082
1819
  const data = parsedOutput.body;
2083
- if (data.Message !== undefined && data.Message !== null) {
1820
+ if (data.Message != null) {
2084
1821
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2085
1822
  }
2086
1823
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2090,9 +1827,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2090
1827
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2091
1828
  };
2092
1829
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2093
- const contents = {};
1830
+ const contents = map({});
2094
1831
  const data = parsedOutput.body;
2095
- if (data.Message !== undefined && data.Message !== null) {
1832
+ if (data.Message != null) {
2096
1833
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2097
1834
  }
2098
1835
  const exception = new models_0_1.ValidationException({
@@ -2126,9 +1863,6 @@ const serializeAws_restJson1LineItemRequestListDefinition = (input, context) =>
2126
1863
  return input
2127
1864
  .filter((e) => e != null)
2128
1865
  .map((entry) => {
2129
- if (entry === null) {
2130
- return null;
2131
- }
2132
1866
  return serializeAws_restJson1LineItemRequest(entry, context);
2133
1867
  });
2134
1868
  };