@aws-sdk/client-mq 3.137.0 → 3.145.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.
@@ -87,16 +87,7 @@ const serializeAws_restJson1CreateTagsCommand = async (input, context) => {
87
87
  "content-type": "application/json",
88
88
  };
89
89
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
90
- if (input.ResourceArn !== undefined) {
91
- const labelValue = input.ResourceArn;
92
- if (labelValue.length <= 0) {
93
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
94
- }
95
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
96
- }
97
- else {
98
- throw new Error("No value provided for input HTTP label: ResourceArn.");
99
- }
90
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
100
91
  let body;
101
92
  body = JSON.stringify({
102
93
  ...(input.Tags != null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }),
@@ -118,26 +109,8 @@ const serializeAws_restJson1CreateUserCommand = async (input, context) => {
118
109
  "content-type": "application/json",
119
110
  };
120
111
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}";
121
- if (input.BrokerId !== undefined) {
122
- const labelValue = input.BrokerId;
123
- if (labelValue.length <= 0) {
124
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
125
- }
126
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
127
- }
128
- else {
129
- throw new Error("No value provided for input HTTP label: BrokerId.");
130
- }
131
- if (input.Username !== undefined) {
132
- const labelValue = input.Username;
133
- if (labelValue.length <= 0) {
134
- throw new Error("Empty value provided for input HTTP label: Username.");
135
- }
136
- resolvedPath = resolvedPath.replace("{Username}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
137
- }
138
- else {
139
- throw new Error("No value provided for input HTTP label: Username.");
140
- }
112
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
113
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Username", () => input.Username, "{Username}", false);
141
114
  let body;
142
115
  body = JSON.stringify({
143
116
  ...(input.ConsoleAccess != null && { consoleAccess: input.ConsoleAccess }),
@@ -159,16 +132,7 @@ const serializeAws_restJson1DeleteBrokerCommand = async (input, context) => {
159
132
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
160
133
  const headers = {};
161
134
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}";
162
- if (input.BrokerId !== undefined) {
163
- const labelValue = input.BrokerId;
164
- if (labelValue.length <= 0) {
165
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
166
- }
167
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
168
- }
169
- else {
170
- throw new Error("No value provided for input HTTP label: BrokerId.");
171
- }
135
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
172
136
  let body;
173
137
  return new protocol_http_1.HttpRequest({
174
138
  protocol,
@@ -185,19 +149,10 @@ const serializeAws_restJson1DeleteTagsCommand = async (input, context) => {
185
149
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
186
150
  const headers = {};
187
151
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
188
- if (input.ResourceArn !== undefined) {
189
- const labelValue = input.ResourceArn;
190
- if (labelValue.length <= 0) {
191
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
192
- }
193
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
194
- }
195
- else {
196
- throw new Error("No value provided for input HTTP label: ResourceArn.");
197
- }
198
- const query = {
199
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
200
- };
152
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
153
+ const query = map({
154
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
155
+ });
201
156
  let body;
202
157
  return new protocol_http_1.HttpRequest({
203
158
  protocol,
@@ -215,26 +170,8 @@ const serializeAws_restJson1DeleteUserCommand = async (input, context) => {
215
170
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
216
171
  const headers = {};
217
172
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}";
218
- if (input.BrokerId !== undefined) {
219
- const labelValue = input.BrokerId;
220
- if (labelValue.length <= 0) {
221
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
222
- }
223
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
224
- }
225
- else {
226
- throw new Error("No value provided for input HTTP label: BrokerId.");
227
- }
228
- if (input.Username !== undefined) {
229
- const labelValue = input.Username;
230
- if (labelValue.length <= 0) {
231
- throw new Error("Empty value provided for input HTTP label: Username.");
232
- }
233
- resolvedPath = resolvedPath.replace("{Username}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
234
- }
235
- else {
236
- throw new Error("No value provided for input HTTP label: Username.");
237
- }
173
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
174
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Username", () => input.Username, "{Username}", false);
238
175
  let body;
239
176
  return new protocol_http_1.HttpRequest({
240
177
  protocol,
@@ -251,16 +188,7 @@ const serializeAws_restJson1DescribeBrokerCommand = async (input, context) => {
251
188
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
252
189
  const headers = {};
253
190
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}";
254
- if (input.BrokerId !== undefined) {
255
- const labelValue = input.BrokerId;
256
- if (labelValue.length <= 0) {
257
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
258
- }
259
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
260
- }
261
- else {
262
- throw new Error("No value provided for input HTTP label: BrokerId.");
263
- }
191
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
264
192
  let body;
265
193
  return new protocol_http_1.HttpRequest({
266
194
  protocol,
@@ -277,11 +205,11 @@ const serializeAws_restJson1DescribeBrokerEngineTypesCommand = async (input, con
277
205
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
278
206
  const headers = {};
279
207
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/broker-engine-types";
280
- const query = {
281
- ...(input.EngineType !== undefined && { engineType: input.EngineType }),
282
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
283
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
284
- };
208
+ const query = map({
209
+ engineType: [, input.EngineType],
210
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
211
+ nextToken: [, input.NextToken],
212
+ });
285
213
  let body;
286
214
  return new protocol_http_1.HttpRequest({
287
215
  protocol,
@@ -299,13 +227,13 @@ const serializeAws_restJson1DescribeBrokerInstanceOptionsCommand = async (input,
299
227
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
300
228
  const headers = {};
301
229
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/broker-instance-options";
302
- const query = {
303
- ...(input.EngineType !== undefined && { engineType: input.EngineType }),
304
- ...(input.HostInstanceType !== undefined && { hostInstanceType: input.HostInstanceType }),
305
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
306
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
307
- ...(input.StorageType !== undefined && { storageType: input.StorageType }),
308
- };
230
+ const query = map({
231
+ engineType: [, input.EngineType],
232
+ hostInstanceType: [, input.HostInstanceType],
233
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
234
+ nextToken: [, input.NextToken],
235
+ storageType: [, input.StorageType],
236
+ });
309
237
  let body;
310
238
  return new protocol_http_1.HttpRequest({
311
239
  protocol,
@@ -323,16 +251,7 @@ const serializeAws_restJson1DescribeConfigurationCommand = async (input, context
323
251
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
324
252
  const headers = {};
325
253
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{ConfigurationId}";
326
- if (input.ConfigurationId !== undefined) {
327
- const labelValue = input.ConfigurationId;
328
- if (labelValue.length <= 0) {
329
- throw new Error("Empty value provided for input HTTP label: ConfigurationId.");
330
- }
331
- resolvedPath = resolvedPath.replace("{ConfigurationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
332
- }
333
- else {
334
- throw new Error("No value provided for input HTTP label: ConfigurationId.");
335
- }
254
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationId", () => input.ConfigurationId, "{ConfigurationId}", false);
336
255
  let body;
337
256
  return new protocol_http_1.HttpRequest({
338
257
  protocol,
@@ -350,26 +269,8 @@ const serializeAws_restJson1DescribeConfigurationRevisionCommand = async (input,
350
269
  const headers = {};
351
270
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
352
271
  "/v1/configurations/{ConfigurationId}/revisions/{ConfigurationRevision}";
353
- if (input.ConfigurationId !== undefined) {
354
- const labelValue = input.ConfigurationId;
355
- if (labelValue.length <= 0) {
356
- throw new Error("Empty value provided for input HTTP label: ConfigurationId.");
357
- }
358
- resolvedPath = resolvedPath.replace("{ConfigurationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
359
- }
360
- else {
361
- throw new Error("No value provided for input HTTP label: ConfigurationId.");
362
- }
363
- if (input.ConfigurationRevision !== undefined) {
364
- const labelValue = input.ConfigurationRevision;
365
- if (labelValue.length <= 0) {
366
- throw new Error("Empty value provided for input HTTP label: ConfigurationRevision.");
367
- }
368
- resolvedPath = resolvedPath.replace("{ConfigurationRevision}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
369
- }
370
- else {
371
- throw new Error("No value provided for input HTTP label: ConfigurationRevision.");
372
- }
272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationId", () => input.ConfigurationId, "{ConfigurationId}", false);
273
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationRevision", () => input.ConfigurationRevision, "{ConfigurationRevision}", false);
373
274
  let body;
374
275
  return new protocol_http_1.HttpRequest({
375
276
  protocol,
@@ -386,26 +287,8 @@ const serializeAws_restJson1DescribeUserCommand = async (input, context) => {
386
287
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
387
288
  const headers = {};
388
289
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}";
389
- if (input.BrokerId !== undefined) {
390
- const labelValue = input.BrokerId;
391
- if (labelValue.length <= 0) {
392
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
393
- }
394
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
395
- }
396
- else {
397
- throw new Error("No value provided for input HTTP label: BrokerId.");
398
- }
399
- if (input.Username !== undefined) {
400
- const labelValue = input.Username;
401
- if (labelValue.length <= 0) {
402
- throw new Error("Empty value provided for input HTTP label: Username.");
403
- }
404
- resolvedPath = resolvedPath.replace("{Username}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
405
- }
406
- else {
407
- throw new Error("No value provided for input HTTP label: Username.");
408
- }
290
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
291
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Username", () => input.Username, "{Username}", false);
409
292
  let body;
410
293
  return new protocol_http_1.HttpRequest({
411
294
  protocol,
@@ -422,10 +305,10 @@ const serializeAws_restJson1ListBrokersCommand = async (input, context) => {
422
305
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
423
306
  const headers = {};
424
307
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers";
425
- const query = {
426
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
427
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
428
- };
308
+ const query = map({
309
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
310
+ nextToken: [, input.NextToken],
311
+ });
429
312
  let body;
430
313
  return new protocol_http_1.HttpRequest({
431
314
  protocol,
@@ -444,20 +327,11 @@ const serializeAws_restJson1ListConfigurationRevisionsCommand = async (input, co
444
327
  const headers = {};
445
328
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
446
329
  "/v1/configurations/{ConfigurationId}/revisions";
447
- if (input.ConfigurationId !== undefined) {
448
- const labelValue = input.ConfigurationId;
449
- if (labelValue.length <= 0) {
450
- throw new Error("Empty value provided for input HTTP label: ConfigurationId.");
451
- }
452
- resolvedPath = resolvedPath.replace("{ConfigurationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
453
- }
454
- else {
455
- throw new Error("No value provided for input HTTP label: ConfigurationId.");
456
- }
457
- const query = {
458
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
459
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
460
- };
330
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationId", () => input.ConfigurationId, "{ConfigurationId}", false);
331
+ const query = map({
332
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
333
+ nextToken: [, input.NextToken],
334
+ });
461
335
  let body;
462
336
  return new protocol_http_1.HttpRequest({
463
337
  protocol,
@@ -475,10 +349,10 @@ const serializeAws_restJson1ListConfigurationsCommand = async (input, context) =
475
349
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
476
350
  const headers = {};
477
351
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations";
478
- const query = {
479
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
480
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
481
- };
352
+ const query = map({
353
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
354
+ nextToken: [, input.NextToken],
355
+ });
482
356
  let body;
483
357
  return new protocol_http_1.HttpRequest({
484
358
  protocol,
@@ -496,16 +370,7 @@ const serializeAws_restJson1ListTagsCommand = async (input, context) => {
496
370
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
497
371
  const headers = {};
498
372
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
499
- if (input.ResourceArn !== undefined) {
500
- const labelValue = input.ResourceArn;
501
- if (labelValue.length <= 0) {
502
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
503
- }
504
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
505
- }
506
- else {
507
- throw new Error("No value provided for input HTTP label: ResourceArn.");
508
- }
373
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
509
374
  let body;
510
375
  return new protocol_http_1.HttpRequest({
511
376
  protocol,
@@ -522,20 +387,11 @@ const serializeAws_restJson1ListUsersCommand = async (input, context) => {
522
387
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
523
388
  const headers = {};
524
389
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users";
525
- if (input.BrokerId !== undefined) {
526
- const labelValue = input.BrokerId;
527
- if (labelValue.length <= 0) {
528
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
529
- }
530
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
531
- }
532
- else {
533
- throw new Error("No value provided for input HTTP label: BrokerId.");
534
- }
535
- const query = {
536
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
537
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
538
- };
390
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
391
+ const query = map({
392
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
393
+ nextToken: [, input.NextToken],
394
+ });
539
395
  let body;
540
396
  return new protocol_http_1.HttpRequest({
541
397
  protocol,
@@ -553,16 +409,7 @@ const serializeAws_restJson1RebootBrokerCommand = async (input, context) => {
553
409
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
554
410
  const headers = {};
555
411
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/reboot";
556
- if (input.BrokerId !== undefined) {
557
- const labelValue = input.BrokerId;
558
- if (labelValue.length <= 0) {
559
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
560
- }
561
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
562
- }
563
- else {
564
- throw new Error("No value provided for input HTTP label: BrokerId.");
565
- }
412
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
566
413
  let body;
567
414
  return new protocol_http_1.HttpRequest({
568
415
  protocol,
@@ -581,16 +428,7 @@ const serializeAws_restJson1UpdateBrokerCommand = async (input, context) => {
581
428
  "content-type": "application/json",
582
429
  };
583
430
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}";
584
- if (input.BrokerId !== undefined) {
585
- const labelValue = input.BrokerId;
586
- if (labelValue.length <= 0) {
587
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
588
- }
589
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
590
- }
591
- else {
592
- throw new Error("No value provided for input HTTP label: BrokerId.");
593
- }
431
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
594
432
  let body;
595
433
  body = JSON.stringify({
596
434
  ...(input.AuthenticationStrategy != null && { authenticationStrategy: input.AuthenticationStrategy }),
@@ -628,16 +466,7 @@ const serializeAws_restJson1UpdateConfigurationCommand = async (input, context)
628
466
  "content-type": "application/json",
629
467
  };
630
468
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{ConfigurationId}";
631
- if (input.ConfigurationId !== undefined) {
632
- const labelValue = input.ConfigurationId;
633
- if (labelValue.length <= 0) {
634
- throw new Error("Empty value provided for input HTTP label: ConfigurationId.");
635
- }
636
- resolvedPath = resolvedPath.replace("{ConfigurationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
637
- }
638
- else {
639
- throw new Error("No value provided for input HTTP label: ConfigurationId.");
640
- }
469
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationId", () => input.ConfigurationId, "{ConfigurationId}", false);
641
470
  let body;
642
471
  body = JSON.stringify({
643
472
  ...(input.Data != null && { data: input.Data }),
@@ -660,26 +489,8 @@ const serializeAws_restJson1UpdateUserCommand = async (input, context) => {
660
489
  "content-type": "application/json",
661
490
  };
662
491
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}";
663
- if (input.BrokerId !== undefined) {
664
- const labelValue = input.BrokerId;
665
- if (labelValue.length <= 0) {
666
- throw new Error("Empty value provided for input HTTP label: BrokerId.");
667
- }
668
- resolvedPath = resolvedPath.replace("{BrokerId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
669
- }
670
- else {
671
- throw new Error("No value provided for input HTTP label: BrokerId.");
672
- }
673
- if (input.Username !== undefined) {
674
- const labelValue = input.Username;
675
- if (labelValue.length <= 0) {
676
- throw new Error("Empty value provided for input HTTP label: Username.");
677
- }
678
- resolvedPath = resolvedPath.replace("{Username}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
679
- }
680
- else {
681
- throw new Error("No value provided for input HTTP label: Username.");
682
- }
492
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BrokerId", () => input.BrokerId, "{BrokerId}", false);
493
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Username", () => input.Username, "{Username}", false);
683
494
  let body;
684
495
  body = JSON.stringify({
685
496
  ...(input.ConsoleAccess != null && { consoleAccess: input.ConsoleAccess }),
@@ -701,19 +512,17 @@ const deserializeAws_restJson1CreateBrokerCommand = async (output, context) => {
701
512
  if (output.statusCode !== 200 && output.statusCode >= 300) {
702
513
  return deserializeAws_restJson1CreateBrokerCommandError(output, context);
703
514
  }
704
- const contents = {
515
+ const contents = map({
705
516
  $metadata: deserializeMetadata(output),
706
- BrokerArn: undefined,
707
- BrokerId: undefined,
708
- };
517
+ });
709
518
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
710
- if (data.brokerArn !== undefined && data.brokerArn !== null) {
519
+ if (data.brokerArn != null) {
711
520
  contents.BrokerArn = (0, smithy_client_1.expectString)(data.brokerArn);
712
521
  }
713
- if (data.brokerId !== undefined && data.brokerId !== null) {
522
+ if (data.brokerId != null) {
714
523
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
715
524
  }
716
- return Promise.resolve(contents);
525
+ return contents;
717
526
  };
718
527
  exports.deserializeAws_restJson1CreateBrokerCommand = deserializeAws_restJson1CreateBrokerCommand;
719
528
  const deserializeAws_restJson1CreateBrokerCommandError = async (output, context) => {
@@ -721,7 +530,6 @@ const deserializeAws_restJson1CreateBrokerCommandError = async (output, context)
721
530
  ...output,
722
531
  body: await parseBody(output.body, context),
723
532
  };
724
- let response;
725
533
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
726
534
  switch (errorCode) {
727
535
  case "BadRequestException":
@@ -741,49 +549,41 @@ const deserializeAws_restJson1CreateBrokerCommandError = async (output, context)
741
549
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
742
550
  default:
743
551
  const parsedBody = parsedOutput.body;
744
- const $metadata = deserializeMetadata(output);
745
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
746
- response = new MqServiceException_1.MqServiceException({
747
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
748
- $fault: "client",
749
- $metadata,
552
+ (0, smithy_client_1.throwDefaultError)({
553
+ output,
554
+ parsedBody,
555
+ exceptionCtor: MqServiceException_1.MqServiceException,
556
+ errorCode,
750
557
  });
751
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
752
558
  }
753
559
  };
754
560
  const deserializeAws_restJson1CreateConfigurationCommand = async (output, context) => {
755
561
  if (output.statusCode !== 200 && output.statusCode >= 300) {
756
562
  return deserializeAws_restJson1CreateConfigurationCommandError(output, context);
757
563
  }
758
- const contents = {
564
+ const contents = map({
759
565
  $metadata: deserializeMetadata(output),
760
- Arn: undefined,
761
- AuthenticationStrategy: undefined,
762
- Created: undefined,
763
- Id: undefined,
764
- LatestRevision: undefined,
765
- Name: undefined,
766
- };
566
+ });
767
567
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
768
- if (data.arn !== undefined && data.arn !== null) {
568
+ if (data.arn != null) {
769
569
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
770
570
  }
771
- if (data.authenticationStrategy !== undefined && data.authenticationStrategy !== null) {
571
+ if (data.authenticationStrategy != null) {
772
572
  contents.AuthenticationStrategy = (0, smithy_client_1.expectString)(data.authenticationStrategy);
773
573
  }
774
- if (data.created !== undefined && data.created !== null) {
574
+ if (data.created != null) {
775
575
  contents.Created = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.created));
776
576
  }
777
- if (data.id !== undefined && data.id !== null) {
577
+ if (data.id != null) {
778
578
  contents.Id = (0, smithy_client_1.expectString)(data.id);
779
579
  }
780
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
580
+ if (data.latestRevision != null) {
781
581
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
782
582
  }
783
- if (data.name !== undefined && data.name !== null) {
583
+ if (data.name != null) {
784
584
  contents.Name = (0, smithy_client_1.expectString)(data.name);
785
585
  }
786
- return Promise.resolve(contents);
586
+ return contents;
787
587
  };
788
588
  exports.deserializeAws_restJson1CreateConfigurationCommand = deserializeAws_restJson1CreateConfigurationCommand;
789
589
  const deserializeAws_restJson1CreateConfigurationCommandError = async (output, context) => {
@@ -791,7 +591,6 @@ const deserializeAws_restJson1CreateConfigurationCommandError = async (output, c
791
591
  ...output,
792
592
  body: await parseBody(output.body, context),
793
593
  };
794
- let response;
795
594
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
796
595
  switch (errorCode) {
797
596
  case "BadRequestException":
@@ -808,25 +607,23 @@ const deserializeAws_restJson1CreateConfigurationCommandError = async (output, c
808
607
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
809
608
  default:
810
609
  const parsedBody = parsedOutput.body;
811
- const $metadata = deserializeMetadata(output);
812
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
813
- response = new MqServiceException_1.MqServiceException({
814
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
815
- $fault: "client",
816
- $metadata,
610
+ (0, smithy_client_1.throwDefaultError)({
611
+ output,
612
+ parsedBody,
613
+ exceptionCtor: MqServiceException_1.MqServiceException,
614
+ errorCode,
817
615
  });
818
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
819
616
  }
820
617
  };
821
618
  const deserializeAws_restJson1CreateTagsCommand = async (output, context) => {
822
619
  if (output.statusCode !== 204 && output.statusCode >= 300) {
823
620
  return deserializeAws_restJson1CreateTagsCommandError(output, context);
824
621
  }
825
- const contents = {
622
+ const contents = map({
826
623
  $metadata: deserializeMetadata(output),
827
- };
624
+ });
828
625
  await collectBody(output.body, context);
829
- return Promise.resolve(contents);
626
+ return contents;
830
627
  };
831
628
  exports.deserializeAws_restJson1CreateTagsCommand = deserializeAws_restJson1CreateTagsCommand;
832
629
  const deserializeAws_restJson1CreateTagsCommandError = async (output, context) => {
@@ -834,7 +631,6 @@ const deserializeAws_restJson1CreateTagsCommandError = async (output, context) =
834
631
  ...output,
835
632
  body: await parseBody(output.body, context),
836
633
  };
837
- let response;
838
634
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
839
635
  switch (errorCode) {
840
636
  case "BadRequestException":
@@ -851,25 +647,23 @@ const deserializeAws_restJson1CreateTagsCommandError = async (output, context) =
851
647
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
852
648
  default:
853
649
  const parsedBody = parsedOutput.body;
854
- const $metadata = deserializeMetadata(output);
855
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
856
- response = new MqServiceException_1.MqServiceException({
857
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
858
- $fault: "client",
859
- $metadata,
650
+ (0, smithy_client_1.throwDefaultError)({
651
+ output,
652
+ parsedBody,
653
+ exceptionCtor: MqServiceException_1.MqServiceException,
654
+ errorCode,
860
655
  });
861
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
862
656
  }
863
657
  };
864
658
  const deserializeAws_restJson1CreateUserCommand = async (output, context) => {
865
659
  if (output.statusCode !== 200 && output.statusCode >= 300) {
866
660
  return deserializeAws_restJson1CreateUserCommandError(output, context);
867
661
  }
868
- const contents = {
662
+ const contents = map({
869
663
  $metadata: deserializeMetadata(output),
870
- };
664
+ });
871
665
  await collectBody(output.body, context);
872
- return Promise.resolve(contents);
666
+ return contents;
873
667
  };
874
668
  exports.deserializeAws_restJson1CreateUserCommand = deserializeAws_restJson1CreateUserCommand;
875
669
  const deserializeAws_restJson1CreateUserCommandError = async (output, context) => {
@@ -877,7 +671,6 @@ const deserializeAws_restJson1CreateUserCommandError = async (output, context) =
877
671
  ...output,
878
672
  body: await parseBody(output.body, context),
879
673
  };
880
- let response;
881
674
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
882
675
  switch (errorCode) {
883
676
  case "BadRequestException":
@@ -897,29 +690,26 @@ const deserializeAws_restJson1CreateUserCommandError = async (output, context) =
897
690
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
898
691
  default:
899
692
  const parsedBody = parsedOutput.body;
900
- const $metadata = deserializeMetadata(output);
901
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
902
- response = new MqServiceException_1.MqServiceException({
903
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
904
- $fault: "client",
905
- $metadata,
693
+ (0, smithy_client_1.throwDefaultError)({
694
+ output,
695
+ parsedBody,
696
+ exceptionCtor: MqServiceException_1.MqServiceException,
697
+ errorCode,
906
698
  });
907
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
908
699
  }
909
700
  };
910
701
  const deserializeAws_restJson1DeleteBrokerCommand = async (output, context) => {
911
702
  if (output.statusCode !== 200 && output.statusCode >= 300) {
912
703
  return deserializeAws_restJson1DeleteBrokerCommandError(output, context);
913
704
  }
914
- const contents = {
705
+ const contents = map({
915
706
  $metadata: deserializeMetadata(output),
916
- BrokerId: undefined,
917
- };
707
+ });
918
708
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
919
- if (data.brokerId !== undefined && data.brokerId !== null) {
709
+ if (data.brokerId != null) {
920
710
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
921
711
  }
922
- return Promise.resolve(contents);
712
+ return contents;
923
713
  };
924
714
  exports.deserializeAws_restJson1DeleteBrokerCommand = deserializeAws_restJson1DeleteBrokerCommand;
925
715
  const deserializeAws_restJson1DeleteBrokerCommandError = async (output, context) => {
@@ -927,7 +717,6 @@ const deserializeAws_restJson1DeleteBrokerCommandError = async (output, context)
927
717
  ...output,
928
718
  body: await parseBody(output.body, context),
929
719
  };
930
- let response;
931
720
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
932
721
  switch (errorCode) {
933
722
  case "BadRequestException":
@@ -944,25 +733,23 @@ const deserializeAws_restJson1DeleteBrokerCommandError = async (output, context)
944
733
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
945
734
  default:
946
735
  const parsedBody = parsedOutput.body;
947
- const $metadata = deserializeMetadata(output);
948
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
949
- response = new MqServiceException_1.MqServiceException({
950
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
951
- $fault: "client",
952
- $metadata,
736
+ (0, smithy_client_1.throwDefaultError)({
737
+ output,
738
+ parsedBody,
739
+ exceptionCtor: MqServiceException_1.MqServiceException,
740
+ errorCode,
953
741
  });
954
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
955
742
  }
956
743
  };
957
744
  const deserializeAws_restJson1DeleteTagsCommand = async (output, context) => {
958
745
  if (output.statusCode !== 204 && output.statusCode >= 300) {
959
746
  return deserializeAws_restJson1DeleteTagsCommandError(output, context);
960
747
  }
961
- const contents = {
748
+ const contents = map({
962
749
  $metadata: deserializeMetadata(output),
963
- };
750
+ });
964
751
  await collectBody(output.body, context);
965
- return Promise.resolve(contents);
752
+ return contents;
966
753
  };
967
754
  exports.deserializeAws_restJson1DeleteTagsCommand = deserializeAws_restJson1DeleteTagsCommand;
968
755
  const deserializeAws_restJson1DeleteTagsCommandError = async (output, context) => {
@@ -970,7 +757,6 @@ const deserializeAws_restJson1DeleteTagsCommandError = async (output, context) =
970
757
  ...output,
971
758
  body: await parseBody(output.body, context),
972
759
  };
973
- let response;
974
760
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
975
761
  switch (errorCode) {
976
762
  case "BadRequestException":
@@ -987,25 +773,23 @@ const deserializeAws_restJson1DeleteTagsCommandError = async (output, context) =
987
773
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
988
774
  default:
989
775
  const parsedBody = parsedOutput.body;
990
- const $metadata = deserializeMetadata(output);
991
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
992
- response = new MqServiceException_1.MqServiceException({
993
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
994
- $fault: "client",
995
- $metadata,
776
+ (0, smithy_client_1.throwDefaultError)({
777
+ output,
778
+ parsedBody,
779
+ exceptionCtor: MqServiceException_1.MqServiceException,
780
+ errorCode,
996
781
  });
997
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
998
782
  }
999
783
  };
1000
784
  const deserializeAws_restJson1DeleteUserCommand = async (output, context) => {
1001
785
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1002
786
  return deserializeAws_restJson1DeleteUserCommandError(output, context);
1003
787
  }
1004
- const contents = {
788
+ const contents = map({
1005
789
  $metadata: deserializeMetadata(output),
1006
- };
790
+ });
1007
791
  await collectBody(output.body, context);
1008
- return Promise.resolve(contents);
792
+ return contents;
1009
793
  };
1010
794
  exports.deserializeAws_restJson1DeleteUserCommand = deserializeAws_restJson1DeleteUserCommand;
1011
795
  const deserializeAws_restJson1DeleteUserCommandError = async (output, context) => {
@@ -1013,7 +797,6 @@ const deserializeAws_restJson1DeleteUserCommandError = async (output, context) =
1013
797
  ...output,
1014
798
  body: await parseBody(output.body, context),
1015
799
  };
1016
- let response;
1017
800
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1018
801
  switch (errorCode) {
1019
802
  case "BadRequestException":
@@ -1030,141 +813,110 @@ const deserializeAws_restJson1DeleteUserCommandError = async (output, context) =
1030
813
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1031
814
  default:
1032
815
  const parsedBody = parsedOutput.body;
1033
- const $metadata = deserializeMetadata(output);
1034
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1035
- response = new MqServiceException_1.MqServiceException({
1036
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1037
- $fault: "client",
1038
- $metadata,
816
+ (0, smithy_client_1.throwDefaultError)({
817
+ output,
818
+ parsedBody,
819
+ exceptionCtor: MqServiceException_1.MqServiceException,
820
+ errorCode,
1039
821
  });
1040
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1041
822
  }
1042
823
  };
1043
824
  const deserializeAws_restJson1DescribeBrokerCommand = async (output, context) => {
1044
825
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1045
826
  return deserializeAws_restJson1DescribeBrokerCommandError(output, context);
1046
827
  }
1047
- const contents = {
828
+ const contents = map({
1048
829
  $metadata: deserializeMetadata(output),
1049
- ActionsRequired: undefined,
1050
- AuthenticationStrategy: undefined,
1051
- AutoMinorVersionUpgrade: undefined,
1052
- BrokerArn: undefined,
1053
- BrokerId: undefined,
1054
- BrokerInstances: undefined,
1055
- BrokerName: undefined,
1056
- BrokerState: undefined,
1057
- Configurations: undefined,
1058
- Created: undefined,
1059
- DeploymentMode: undefined,
1060
- EncryptionOptions: undefined,
1061
- EngineType: undefined,
1062
- EngineVersion: undefined,
1063
- HostInstanceType: undefined,
1064
- LdapServerMetadata: undefined,
1065
- Logs: undefined,
1066
- MaintenanceWindowStartTime: undefined,
1067
- PendingAuthenticationStrategy: undefined,
1068
- PendingEngineVersion: undefined,
1069
- PendingHostInstanceType: undefined,
1070
- PendingLdapServerMetadata: undefined,
1071
- PendingSecurityGroups: undefined,
1072
- PubliclyAccessible: undefined,
1073
- SecurityGroups: undefined,
1074
- StorageType: undefined,
1075
- SubnetIds: undefined,
1076
- Tags: undefined,
1077
- Users: undefined,
1078
- };
830
+ });
1079
831
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1080
- if (data.actionsRequired !== undefined && data.actionsRequired !== null) {
832
+ if (data.actionsRequired != null) {
1081
833
  contents.ActionsRequired = deserializeAws_restJson1__listOfActionRequired(data.actionsRequired, context);
1082
834
  }
1083
- if (data.authenticationStrategy !== undefined && data.authenticationStrategy !== null) {
835
+ if (data.authenticationStrategy != null) {
1084
836
  contents.AuthenticationStrategy = (0, smithy_client_1.expectString)(data.authenticationStrategy);
1085
837
  }
1086
- if (data.autoMinorVersionUpgrade !== undefined && data.autoMinorVersionUpgrade !== null) {
838
+ if (data.autoMinorVersionUpgrade != null) {
1087
839
  contents.AutoMinorVersionUpgrade = (0, smithy_client_1.expectBoolean)(data.autoMinorVersionUpgrade);
1088
840
  }
1089
- if (data.brokerArn !== undefined && data.brokerArn !== null) {
841
+ if (data.brokerArn != null) {
1090
842
  contents.BrokerArn = (0, smithy_client_1.expectString)(data.brokerArn);
1091
843
  }
1092
- if (data.brokerId !== undefined && data.brokerId !== null) {
844
+ if (data.brokerId != null) {
1093
845
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
1094
846
  }
1095
- if (data.brokerInstances !== undefined && data.brokerInstances !== null) {
847
+ if (data.brokerInstances != null) {
1096
848
  contents.BrokerInstances = deserializeAws_restJson1__listOfBrokerInstance(data.brokerInstances, context);
1097
849
  }
1098
- if (data.brokerName !== undefined && data.brokerName !== null) {
850
+ if (data.brokerName != null) {
1099
851
  contents.BrokerName = (0, smithy_client_1.expectString)(data.brokerName);
1100
852
  }
1101
- if (data.brokerState !== undefined && data.brokerState !== null) {
853
+ if (data.brokerState != null) {
1102
854
  contents.BrokerState = (0, smithy_client_1.expectString)(data.brokerState);
1103
855
  }
1104
- if (data.configurations !== undefined && data.configurations !== null) {
856
+ if (data.configurations != null) {
1105
857
  contents.Configurations = deserializeAws_restJson1Configurations(data.configurations, context);
1106
858
  }
1107
- if (data.created !== undefined && data.created !== null) {
859
+ if (data.created != null) {
1108
860
  contents.Created = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.created));
1109
861
  }
1110
- if (data.deploymentMode !== undefined && data.deploymentMode !== null) {
862
+ if (data.deploymentMode != null) {
1111
863
  contents.DeploymentMode = (0, smithy_client_1.expectString)(data.deploymentMode);
1112
864
  }
1113
- if (data.encryptionOptions !== undefined && data.encryptionOptions !== null) {
865
+ if (data.encryptionOptions != null) {
1114
866
  contents.EncryptionOptions = deserializeAws_restJson1EncryptionOptions(data.encryptionOptions, context);
1115
867
  }
1116
- if (data.engineType !== undefined && data.engineType !== null) {
868
+ if (data.engineType != null) {
1117
869
  contents.EngineType = (0, smithy_client_1.expectString)(data.engineType);
1118
870
  }
1119
- if (data.engineVersion !== undefined && data.engineVersion !== null) {
871
+ if (data.engineVersion != null) {
1120
872
  contents.EngineVersion = (0, smithy_client_1.expectString)(data.engineVersion);
1121
873
  }
1122
- if (data.hostInstanceType !== undefined && data.hostInstanceType !== null) {
874
+ if (data.hostInstanceType != null) {
1123
875
  contents.HostInstanceType = (0, smithy_client_1.expectString)(data.hostInstanceType);
1124
876
  }
1125
- if (data.ldapServerMetadata !== undefined && data.ldapServerMetadata !== null) {
877
+ if (data.ldapServerMetadata != null) {
1126
878
  contents.LdapServerMetadata = deserializeAws_restJson1LdapServerMetadataOutput(data.ldapServerMetadata, context);
1127
879
  }
1128
- if (data.logs !== undefined && data.logs !== null) {
880
+ if (data.logs != null) {
1129
881
  contents.Logs = deserializeAws_restJson1LogsSummary(data.logs, context);
1130
882
  }
1131
- if (data.maintenanceWindowStartTime !== undefined && data.maintenanceWindowStartTime !== null) {
883
+ if (data.maintenanceWindowStartTime != null) {
1132
884
  contents.MaintenanceWindowStartTime = deserializeAws_restJson1WeeklyStartTime(data.maintenanceWindowStartTime, context);
1133
885
  }
1134
- if (data.pendingAuthenticationStrategy !== undefined && data.pendingAuthenticationStrategy !== null) {
886
+ if (data.pendingAuthenticationStrategy != null) {
1135
887
  contents.PendingAuthenticationStrategy = (0, smithy_client_1.expectString)(data.pendingAuthenticationStrategy);
1136
888
  }
1137
- if (data.pendingEngineVersion !== undefined && data.pendingEngineVersion !== null) {
889
+ if (data.pendingEngineVersion != null) {
1138
890
  contents.PendingEngineVersion = (0, smithy_client_1.expectString)(data.pendingEngineVersion);
1139
891
  }
1140
- if (data.pendingHostInstanceType !== undefined && data.pendingHostInstanceType !== null) {
892
+ if (data.pendingHostInstanceType != null) {
1141
893
  contents.PendingHostInstanceType = (0, smithy_client_1.expectString)(data.pendingHostInstanceType);
1142
894
  }
1143
- if (data.pendingLdapServerMetadata !== undefined && data.pendingLdapServerMetadata !== null) {
895
+ if (data.pendingLdapServerMetadata != null) {
1144
896
  contents.PendingLdapServerMetadata = deserializeAws_restJson1LdapServerMetadataOutput(data.pendingLdapServerMetadata, context);
1145
897
  }
1146
- if (data.pendingSecurityGroups !== undefined && data.pendingSecurityGroups !== null) {
898
+ if (data.pendingSecurityGroups != null) {
1147
899
  contents.PendingSecurityGroups = deserializeAws_restJson1__listOf__string(data.pendingSecurityGroups, context);
1148
900
  }
1149
- if (data.publiclyAccessible !== undefined && data.publiclyAccessible !== null) {
901
+ if (data.publiclyAccessible != null) {
1150
902
  contents.PubliclyAccessible = (0, smithy_client_1.expectBoolean)(data.publiclyAccessible);
1151
903
  }
1152
- if (data.securityGroups !== undefined && data.securityGroups !== null) {
904
+ if (data.securityGroups != null) {
1153
905
  contents.SecurityGroups = deserializeAws_restJson1__listOf__string(data.securityGroups, context);
1154
906
  }
1155
- if (data.storageType !== undefined && data.storageType !== null) {
907
+ if (data.storageType != null) {
1156
908
  contents.StorageType = (0, smithy_client_1.expectString)(data.storageType);
1157
909
  }
1158
- if (data.subnetIds !== undefined && data.subnetIds !== null) {
910
+ if (data.subnetIds != null) {
1159
911
  contents.SubnetIds = deserializeAws_restJson1__listOf__string(data.subnetIds, context);
1160
912
  }
1161
- if (data.tags !== undefined && data.tags !== null) {
913
+ if (data.tags != null) {
1162
914
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1163
915
  }
1164
- if (data.users !== undefined && data.users !== null) {
916
+ if (data.users != null) {
1165
917
  contents.Users = deserializeAws_restJson1__listOfUserSummary(data.users, context);
1166
918
  }
1167
- return Promise.resolve(contents);
919
+ return contents;
1168
920
  };
1169
921
  exports.deserializeAws_restJson1DescribeBrokerCommand = deserializeAws_restJson1DescribeBrokerCommand;
1170
922
  const deserializeAws_restJson1DescribeBrokerCommandError = async (output, context) => {
@@ -1172,7 +924,6 @@ const deserializeAws_restJson1DescribeBrokerCommandError = async (output, contex
1172
924
  ...output,
1173
925
  body: await parseBody(output.body, context),
1174
926
  };
1175
- let response;
1176
927
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1177
928
  switch (errorCode) {
1178
929
  case "BadRequestException":
@@ -1189,37 +940,32 @@ const deserializeAws_restJson1DescribeBrokerCommandError = async (output, contex
1189
940
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1190
941
  default:
1191
942
  const parsedBody = parsedOutput.body;
1192
- const $metadata = deserializeMetadata(output);
1193
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1194
- response = new MqServiceException_1.MqServiceException({
1195
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1196
- $fault: "client",
1197
- $metadata,
943
+ (0, smithy_client_1.throwDefaultError)({
944
+ output,
945
+ parsedBody,
946
+ exceptionCtor: MqServiceException_1.MqServiceException,
947
+ errorCode,
1198
948
  });
1199
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1200
949
  }
1201
950
  };
1202
951
  const deserializeAws_restJson1DescribeBrokerEngineTypesCommand = async (output, context) => {
1203
952
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1204
953
  return deserializeAws_restJson1DescribeBrokerEngineTypesCommandError(output, context);
1205
954
  }
1206
- const contents = {
955
+ const contents = map({
1207
956
  $metadata: deserializeMetadata(output),
1208
- BrokerEngineTypes: undefined,
1209
- MaxResults: undefined,
1210
- NextToken: undefined,
1211
- };
957
+ });
1212
958
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1213
- if (data.brokerEngineTypes !== undefined && data.brokerEngineTypes !== null) {
959
+ if (data.brokerEngineTypes != null) {
1214
960
  contents.BrokerEngineTypes = deserializeAws_restJson1__listOfBrokerEngineType(data.brokerEngineTypes, context);
1215
961
  }
1216
- if (data.maxResults !== undefined && data.maxResults !== null) {
962
+ if (data.maxResults != null) {
1217
963
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.maxResults);
1218
964
  }
1219
- if (data.nextToken !== undefined && data.nextToken !== null) {
965
+ if (data.nextToken != null) {
1220
966
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1221
967
  }
1222
- return Promise.resolve(contents);
968
+ return contents;
1223
969
  };
1224
970
  exports.deserializeAws_restJson1DescribeBrokerEngineTypesCommand = deserializeAws_restJson1DescribeBrokerEngineTypesCommand;
1225
971
  const deserializeAws_restJson1DescribeBrokerEngineTypesCommandError = async (output, context) => {
@@ -1227,7 +973,6 @@ const deserializeAws_restJson1DescribeBrokerEngineTypesCommandError = async (out
1227
973
  ...output,
1228
974
  body: await parseBody(output.body, context),
1229
975
  };
1230
- let response;
1231
976
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1232
977
  switch (errorCode) {
1233
978
  case "BadRequestException":
@@ -1241,37 +986,32 @@ const deserializeAws_restJson1DescribeBrokerEngineTypesCommandError = async (out
1241
986
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
1242
987
  default:
1243
988
  const parsedBody = parsedOutput.body;
1244
- const $metadata = deserializeMetadata(output);
1245
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1246
- response = new MqServiceException_1.MqServiceException({
1247
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1248
- $fault: "client",
1249
- $metadata,
989
+ (0, smithy_client_1.throwDefaultError)({
990
+ output,
991
+ parsedBody,
992
+ exceptionCtor: MqServiceException_1.MqServiceException,
993
+ errorCode,
1250
994
  });
1251
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1252
995
  }
1253
996
  };
1254
997
  const deserializeAws_restJson1DescribeBrokerInstanceOptionsCommand = async (output, context) => {
1255
998
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1256
999
  return deserializeAws_restJson1DescribeBrokerInstanceOptionsCommandError(output, context);
1257
1000
  }
1258
- const contents = {
1001
+ const contents = map({
1259
1002
  $metadata: deserializeMetadata(output),
1260
- BrokerInstanceOptions: undefined,
1261
- MaxResults: undefined,
1262
- NextToken: undefined,
1263
- };
1003
+ });
1264
1004
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1265
- if (data.brokerInstanceOptions !== undefined && data.brokerInstanceOptions !== null) {
1005
+ if (data.brokerInstanceOptions != null) {
1266
1006
  contents.BrokerInstanceOptions = deserializeAws_restJson1__listOfBrokerInstanceOption(data.brokerInstanceOptions, context);
1267
1007
  }
1268
- if (data.maxResults !== undefined && data.maxResults !== null) {
1008
+ if (data.maxResults != null) {
1269
1009
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.maxResults);
1270
1010
  }
1271
- if (data.nextToken !== undefined && data.nextToken !== null) {
1011
+ if (data.nextToken != null) {
1272
1012
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1273
1013
  }
1274
- return Promise.resolve(contents);
1014
+ return contents;
1275
1015
  };
1276
1016
  exports.deserializeAws_restJson1DescribeBrokerInstanceOptionsCommand = deserializeAws_restJson1DescribeBrokerInstanceOptionsCommand;
1277
1017
  const deserializeAws_restJson1DescribeBrokerInstanceOptionsCommandError = async (output, context) => {
@@ -1279,7 +1019,6 @@ const deserializeAws_restJson1DescribeBrokerInstanceOptionsCommandError = async
1279
1019
  ...output,
1280
1020
  body: await parseBody(output.body, context),
1281
1021
  };
1282
- let response;
1283
1022
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1284
1023
  switch (errorCode) {
1285
1024
  case "BadRequestException":
@@ -1293,65 +1032,53 @@ const deserializeAws_restJson1DescribeBrokerInstanceOptionsCommandError = async
1293
1032
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
1294
1033
  default:
1295
1034
  const parsedBody = parsedOutput.body;
1296
- const $metadata = deserializeMetadata(output);
1297
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1298
- response = new MqServiceException_1.MqServiceException({
1299
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1300
- $fault: "client",
1301
- $metadata,
1035
+ (0, smithy_client_1.throwDefaultError)({
1036
+ output,
1037
+ parsedBody,
1038
+ exceptionCtor: MqServiceException_1.MqServiceException,
1039
+ errorCode,
1302
1040
  });
1303
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1304
1041
  }
1305
1042
  };
1306
1043
  const deserializeAws_restJson1DescribeConfigurationCommand = async (output, context) => {
1307
1044
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1308
1045
  return deserializeAws_restJson1DescribeConfigurationCommandError(output, context);
1309
1046
  }
1310
- const contents = {
1047
+ const contents = map({
1311
1048
  $metadata: deserializeMetadata(output),
1312
- Arn: undefined,
1313
- AuthenticationStrategy: undefined,
1314
- Created: undefined,
1315
- Description: undefined,
1316
- EngineType: undefined,
1317
- EngineVersion: undefined,
1318
- Id: undefined,
1319
- LatestRevision: undefined,
1320
- Name: undefined,
1321
- Tags: undefined,
1322
- };
1049
+ });
1323
1050
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1324
- if (data.arn !== undefined && data.arn !== null) {
1051
+ if (data.arn != null) {
1325
1052
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1326
1053
  }
1327
- if (data.authenticationStrategy !== undefined && data.authenticationStrategy !== null) {
1054
+ if (data.authenticationStrategy != null) {
1328
1055
  contents.AuthenticationStrategy = (0, smithy_client_1.expectString)(data.authenticationStrategy);
1329
1056
  }
1330
- if (data.created !== undefined && data.created !== null) {
1057
+ if (data.created != null) {
1331
1058
  contents.Created = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.created));
1332
1059
  }
1333
- if (data.description !== undefined && data.description !== null) {
1060
+ if (data.description != null) {
1334
1061
  contents.Description = (0, smithy_client_1.expectString)(data.description);
1335
1062
  }
1336
- if (data.engineType !== undefined && data.engineType !== null) {
1063
+ if (data.engineType != null) {
1337
1064
  contents.EngineType = (0, smithy_client_1.expectString)(data.engineType);
1338
1065
  }
1339
- if (data.engineVersion !== undefined && data.engineVersion !== null) {
1066
+ if (data.engineVersion != null) {
1340
1067
  contents.EngineVersion = (0, smithy_client_1.expectString)(data.engineVersion);
1341
1068
  }
1342
- if (data.id !== undefined && data.id !== null) {
1069
+ if (data.id != null) {
1343
1070
  contents.Id = (0, smithy_client_1.expectString)(data.id);
1344
1071
  }
1345
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
1072
+ if (data.latestRevision != null) {
1346
1073
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
1347
1074
  }
1348
- if (data.name !== undefined && data.name !== null) {
1075
+ if (data.name != null) {
1349
1076
  contents.Name = (0, smithy_client_1.expectString)(data.name);
1350
1077
  }
1351
- if (data.tags !== undefined && data.tags !== null) {
1078
+ if (data.tags != null) {
1352
1079
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1353
1080
  }
1354
- return Promise.resolve(contents);
1081
+ return contents;
1355
1082
  };
1356
1083
  exports.deserializeAws_restJson1DescribeConfigurationCommand = deserializeAws_restJson1DescribeConfigurationCommand;
1357
1084
  const deserializeAws_restJson1DescribeConfigurationCommandError = async (output, context) => {
@@ -1359,7 +1086,6 @@ const deserializeAws_restJson1DescribeConfigurationCommandError = async (output,
1359
1086
  ...output,
1360
1087
  body: await parseBody(output.body, context),
1361
1088
  };
1362
- let response;
1363
1089
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1364
1090
  switch (errorCode) {
1365
1091
  case "BadRequestException":
@@ -1376,41 +1102,35 @@ const deserializeAws_restJson1DescribeConfigurationCommandError = async (output,
1376
1102
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1377
1103
  default:
1378
1104
  const parsedBody = parsedOutput.body;
1379
- const $metadata = deserializeMetadata(output);
1380
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1381
- response = new MqServiceException_1.MqServiceException({
1382
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1383
- $fault: "client",
1384
- $metadata,
1105
+ (0, smithy_client_1.throwDefaultError)({
1106
+ output,
1107
+ parsedBody,
1108
+ exceptionCtor: MqServiceException_1.MqServiceException,
1109
+ errorCode,
1385
1110
  });
1386
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1387
1111
  }
1388
1112
  };
1389
1113
  const deserializeAws_restJson1DescribeConfigurationRevisionCommand = async (output, context) => {
1390
1114
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1391
1115
  return deserializeAws_restJson1DescribeConfigurationRevisionCommandError(output, context);
1392
1116
  }
1393
- const contents = {
1117
+ const contents = map({
1394
1118
  $metadata: deserializeMetadata(output),
1395
- ConfigurationId: undefined,
1396
- Created: undefined,
1397
- Data: undefined,
1398
- Description: undefined,
1399
- };
1119
+ });
1400
1120
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1401
- if (data.configurationId !== undefined && data.configurationId !== null) {
1121
+ if (data.configurationId != null) {
1402
1122
  contents.ConfigurationId = (0, smithy_client_1.expectString)(data.configurationId);
1403
1123
  }
1404
- if (data.created !== undefined && data.created !== null) {
1124
+ if (data.created != null) {
1405
1125
  contents.Created = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.created));
1406
1126
  }
1407
- if (data.data !== undefined && data.data !== null) {
1127
+ if (data.data != null) {
1408
1128
  contents.Data = (0, smithy_client_1.expectString)(data.data);
1409
1129
  }
1410
- if (data.description !== undefined && data.description !== null) {
1130
+ if (data.description != null) {
1411
1131
  contents.Description = (0, smithy_client_1.expectString)(data.description);
1412
1132
  }
1413
- return Promise.resolve(contents);
1133
+ return contents;
1414
1134
  };
1415
1135
  exports.deserializeAws_restJson1DescribeConfigurationRevisionCommand = deserializeAws_restJson1DescribeConfigurationRevisionCommand;
1416
1136
  const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async (output, context) => {
@@ -1418,7 +1138,6 @@ const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async
1418
1138
  ...output,
1419
1139
  body: await parseBody(output.body, context),
1420
1140
  };
1421
- let response;
1422
1141
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1423
1142
  switch (errorCode) {
1424
1143
  case "BadRequestException":
@@ -1435,45 +1154,38 @@ const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async
1435
1154
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1436
1155
  default:
1437
1156
  const parsedBody = parsedOutput.body;
1438
- const $metadata = deserializeMetadata(output);
1439
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1440
- response = new MqServiceException_1.MqServiceException({
1441
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1442
- $fault: "client",
1443
- $metadata,
1157
+ (0, smithy_client_1.throwDefaultError)({
1158
+ output,
1159
+ parsedBody,
1160
+ exceptionCtor: MqServiceException_1.MqServiceException,
1161
+ errorCode,
1444
1162
  });
1445
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1446
1163
  }
1447
1164
  };
1448
1165
  const deserializeAws_restJson1DescribeUserCommand = async (output, context) => {
1449
1166
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1450
1167
  return deserializeAws_restJson1DescribeUserCommandError(output, context);
1451
1168
  }
1452
- const contents = {
1169
+ const contents = map({
1453
1170
  $metadata: deserializeMetadata(output),
1454
- BrokerId: undefined,
1455
- ConsoleAccess: undefined,
1456
- Groups: undefined,
1457
- Pending: undefined,
1458
- Username: undefined,
1459
- };
1171
+ });
1460
1172
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1461
- if (data.brokerId !== undefined && data.brokerId !== null) {
1173
+ if (data.brokerId != null) {
1462
1174
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
1463
1175
  }
1464
- if (data.consoleAccess !== undefined && data.consoleAccess !== null) {
1176
+ if (data.consoleAccess != null) {
1465
1177
  contents.ConsoleAccess = (0, smithy_client_1.expectBoolean)(data.consoleAccess);
1466
1178
  }
1467
- if (data.groups !== undefined && data.groups !== null) {
1179
+ if (data.groups != null) {
1468
1180
  contents.Groups = deserializeAws_restJson1__listOf__string(data.groups, context);
1469
1181
  }
1470
- if (data.pending !== undefined && data.pending !== null) {
1182
+ if (data.pending != null) {
1471
1183
  contents.Pending = deserializeAws_restJson1UserPendingChanges(data.pending, context);
1472
1184
  }
1473
- if (data.username !== undefined && data.username !== null) {
1185
+ if (data.username != null) {
1474
1186
  contents.Username = (0, smithy_client_1.expectString)(data.username);
1475
1187
  }
1476
- return Promise.resolve(contents);
1188
+ return contents;
1477
1189
  };
1478
1190
  exports.deserializeAws_restJson1DescribeUserCommand = deserializeAws_restJson1DescribeUserCommand;
1479
1191
  const deserializeAws_restJson1DescribeUserCommandError = async (output, context) => {
@@ -1481,7 +1193,6 @@ const deserializeAws_restJson1DescribeUserCommandError = async (output, context)
1481
1193
  ...output,
1482
1194
  body: await parseBody(output.body, context),
1483
1195
  };
1484
- let response;
1485
1196
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1486
1197
  switch (errorCode) {
1487
1198
  case "BadRequestException":
@@ -1498,33 +1209,29 @@ const deserializeAws_restJson1DescribeUserCommandError = async (output, context)
1498
1209
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1499
1210
  default:
1500
1211
  const parsedBody = parsedOutput.body;
1501
- const $metadata = deserializeMetadata(output);
1502
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1503
- response = new MqServiceException_1.MqServiceException({
1504
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1505
- $fault: "client",
1506
- $metadata,
1212
+ (0, smithy_client_1.throwDefaultError)({
1213
+ output,
1214
+ parsedBody,
1215
+ exceptionCtor: MqServiceException_1.MqServiceException,
1216
+ errorCode,
1507
1217
  });
1508
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1509
1218
  }
1510
1219
  };
1511
1220
  const deserializeAws_restJson1ListBrokersCommand = async (output, context) => {
1512
1221
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1513
1222
  return deserializeAws_restJson1ListBrokersCommandError(output, context);
1514
1223
  }
1515
- const contents = {
1224
+ const contents = map({
1516
1225
  $metadata: deserializeMetadata(output),
1517
- BrokerSummaries: undefined,
1518
- NextToken: undefined,
1519
- };
1226
+ });
1520
1227
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1521
- if (data.brokerSummaries !== undefined && data.brokerSummaries !== null) {
1228
+ if (data.brokerSummaries != null) {
1522
1229
  contents.BrokerSummaries = deserializeAws_restJson1__listOfBrokerSummary(data.brokerSummaries, context);
1523
1230
  }
1524
- if (data.nextToken !== undefined && data.nextToken !== null) {
1231
+ if (data.nextToken != null) {
1525
1232
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1526
1233
  }
1527
- return Promise.resolve(contents);
1234
+ return contents;
1528
1235
  };
1529
1236
  exports.deserializeAws_restJson1ListBrokersCommand = deserializeAws_restJson1ListBrokersCommand;
1530
1237
  const deserializeAws_restJson1ListBrokersCommandError = async (output, context) => {
@@ -1532,7 +1239,6 @@ const deserializeAws_restJson1ListBrokersCommandError = async (output, context)
1532
1239
  ...output,
1533
1240
  body: await parseBody(output.body, context),
1534
1241
  };
1535
- let response;
1536
1242
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1537
1243
  switch (errorCode) {
1538
1244
  case "BadRequestException":
@@ -1546,41 +1252,35 @@ const deserializeAws_restJson1ListBrokersCommandError = async (output, context)
1546
1252
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
1547
1253
  default:
1548
1254
  const parsedBody = parsedOutput.body;
1549
- const $metadata = deserializeMetadata(output);
1550
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1551
- response = new MqServiceException_1.MqServiceException({
1552
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1553
- $fault: "client",
1554
- $metadata,
1255
+ (0, smithy_client_1.throwDefaultError)({
1256
+ output,
1257
+ parsedBody,
1258
+ exceptionCtor: MqServiceException_1.MqServiceException,
1259
+ errorCode,
1555
1260
  });
1556
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1557
1261
  }
1558
1262
  };
1559
1263
  const deserializeAws_restJson1ListConfigurationRevisionsCommand = async (output, context) => {
1560
1264
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1561
1265
  return deserializeAws_restJson1ListConfigurationRevisionsCommandError(output, context);
1562
1266
  }
1563
- const contents = {
1267
+ const contents = map({
1564
1268
  $metadata: deserializeMetadata(output),
1565
- ConfigurationId: undefined,
1566
- MaxResults: undefined,
1567
- NextToken: undefined,
1568
- Revisions: undefined,
1569
- };
1269
+ });
1570
1270
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1571
- if (data.configurationId !== undefined && data.configurationId !== null) {
1271
+ if (data.configurationId != null) {
1572
1272
  contents.ConfigurationId = (0, smithy_client_1.expectString)(data.configurationId);
1573
1273
  }
1574
- if (data.maxResults !== undefined && data.maxResults !== null) {
1274
+ if (data.maxResults != null) {
1575
1275
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.maxResults);
1576
1276
  }
1577
- if (data.nextToken !== undefined && data.nextToken !== null) {
1277
+ if (data.nextToken != null) {
1578
1278
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1579
1279
  }
1580
- if (data.revisions !== undefined && data.revisions !== null) {
1280
+ if (data.revisions != null) {
1581
1281
  contents.Revisions = deserializeAws_restJson1__listOfConfigurationRevision(data.revisions, context);
1582
1282
  }
1583
- return Promise.resolve(contents);
1283
+ return contents;
1584
1284
  };
1585
1285
  exports.deserializeAws_restJson1ListConfigurationRevisionsCommand = deserializeAws_restJson1ListConfigurationRevisionsCommand;
1586
1286
  const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (output, context) => {
@@ -1588,7 +1288,6 @@ const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (ou
1588
1288
  ...output,
1589
1289
  body: await parseBody(output.body, context),
1590
1290
  };
1591
- let response;
1592
1291
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1593
1292
  switch (errorCode) {
1594
1293
  case "BadRequestException":
@@ -1605,37 +1304,32 @@ const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (ou
1605
1304
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1606
1305
  default:
1607
1306
  const parsedBody = parsedOutput.body;
1608
- const $metadata = deserializeMetadata(output);
1609
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1610
- response = new MqServiceException_1.MqServiceException({
1611
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1612
- $fault: "client",
1613
- $metadata,
1307
+ (0, smithy_client_1.throwDefaultError)({
1308
+ output,
1309
+ parsedBody,
1310
+ exceptionCtor: MqServiceException_1.MqServiceException,
1311
+ errorCode,
1614
1312
  });
1615
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1616
1313
  }
1617
1314
  };
1618
1315
  const deserializeAws_restJson1ListConfigurationsCommand = async (output, context) => {
1619
1316
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1620
1317
  return deserializeAws_restJson1ListConfigurationsCommandError(output, context);
1621
1318
  }
1622
- const contents = {
1319
+ const contents = map({
1623
1320
  $metadata: deserializeMetadata(output),
1624
- Configurations: undefined,
1625
- MaxResults: undefined,
1626
- NextToken: undefined,
1627
- };
1321
+ });
1628
1322
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1629
- if (data.configurations !== undefined && data.configurations !== null) {
1323
+ if (data.configurations != null) {
1630
1324
  contents.Configurations = deserializeAws_restJson1__listOfConfiguration(data.configurations, context);
1631
1325
  }
1632
- if (data.maxResults !== undefined && data.maxResults !== null) {
1326
+ if (data.maxResults != null) {
1633
1327
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.maxResults);
1634
1328
  }
1635
- if (data.nextToken !== undefined && data.nextToken !== null) {
1329
+ if (data.nextToken != null) {
1636
1330
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1637
1331
  }
1638
- return Promise.resolve(contents);
1332
+ return contents;
1639
1333
  };
1640
1334
  exports.deserializeAws_restJson1ListConfigurationsCommand = deserializeAws_restJson1ListConfigurationsCommand;
1641
1335
  const deserializeAws_restJson1ListConfigurationsCommandError = async (output, context) => {
@@ -1643,7 +1337,6 @@ const deserializeAws_restJson1ListConfigurationsCommandError = async (output, co
1643
1337
  ...output,
1644
1338
  body: await parseBody(output.body, context),
1645
1339
  };
1646
- let response;
1647
1340
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1648
1341
  switch (errorCode) {
1649
1342
  case "BadRequestException":
@@ -1657,29 +1350,26 @@ const deserializeAws_restJson1ListConfigurationsCommandError = async (output, co
1657
1350
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
1658
1351
  default:
1659
1352
  const parsedBody = parsedOutput.body;
1660
- const $metadata = deserializeMetadata(output);
1661
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1662
- response = new MqServiceException_1.MqServiceException({
1663
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1664
- $fault: "client",
1665
- $metadata,
1353
+ (0, smithy_client_1.throwDefaultError)({
1354
+ output,
1355
+ parsedBody,
1356
+ exceptionCtor: MqServiceException_1.MqServiceException,
1357
+ errorCode,
1666
1358
  });
1667
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1668
1359
  }
1669
1360
  };
1670
1361
  const deserializeAws_restJson1ListTagsCommand = async (output, context) => {
1671
1362
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1672
1363
  return deserializeAws_restJson1ListTagsCommandError(output, context);
1673
1364
  }
1674
- const contents = {
1365
+ const contents = map({
1675
1366
  $metadata: deserializeMetadata(output),
1676
- Tags: undefined,
1677
- };
1367
+ });
1678
1368
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1679
- if (data.tags !== undefined && data.tags !== null) {
1369
+ if (data.tags != null) {
1680
1370
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1681
1371
  }
1682
- return Promise.resolve(contents);
1372
+ return contents;
1683
1373
  };
1684
1374
  exports.deserializeAws_restJson1ListTagsCommand = deserializeAws_restJson1ListTagsCommand;
1685
1375
  const deserializeAws_restJson1ListTagsCommandError = async (output, context) => {
@@ -1687,7 +1377,6 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
1687
1377
  ...output,
1688
1378
  body: await parseBody(output.body, context),
1689
1379
  };
1690
- let response;
1691
1380
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1692
1381
  switch (errorCode) {
1693
1382
  case "BadRequestException":
@@ -1704,41 +1393,35 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
1704
1393
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1705
1394
  default:
1706
1395
  const parsedBody = parsedOutput.body;
1707
- const $metadata = deserializeMetadata(output);
1708
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1709
- response = new MqServiceException_1.MqServiceException({
1710
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1711
- $fault: "client",
1712
- $metadata,
1396
+ (0, smithy_client_1.throwDefaultError)({
1397
+ output,
1398
+ parsedBody,
1399
+ exceptionCtor: MqServiceException_1.MqServiceException,
1400
+ errorCode,
1713
1401
  });
1714
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1715
1402
  }
1716
1403
  };
1717
1404
  const deserializeAws_restJson1ListUsersCommand = async (output, context) => {
1718
1405
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1719
1406
  return deserializeAws_restJson1ListUsersCommandError(output, context);
1720
1407
  }
1721
- const contents = {
1408
+ const contents = map({
1722
1409
  $metadata: deserializeMetadata(output),
1723
- BrokerId: undefined,
1724
- MaxResults: undefined,
1725
- NextToken: undefined,
1726
- Users: undefined,
1727
- };
1410
+ });
1728
1411
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1729
- if (data.brokerId !== undefined && data.brokerId !== null) {
1412
+ if (data.brokerId != null) {
1730
1413
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
1731
1414
  }
1732
- if (data.maxResults !== undefined && data.maxResults !== null) {
1415
+ if (data.maxResults != null) {
1733
1416
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.maxResults);
1734
1417
  }
1735
- if (data.nextToken !== undefined && data.nextToken !== null) {
1418
+ if (data.nextToken != null) {
1736
1419
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1737
1420
  }
1738
- if (data.users !== undefined && data.users !== null) {
1421
+ if (data.users != null) {
1739
1422
  contents.Users = deserializeAws_restJson1__listOfUserSummary(data.users, context);
1740
1423
  }
1741
- return Promise.resolve(contents);
1424
+ return contents;
1742
1425
  };
1743
1426
  exports.deserializeAws_restJson1ListUsersCommand = deserializeAws_restJson1ListUsersCommand;
1744
1427
  const deserializeAws_restJson1ListUsersCommandError = async (output, context) => {
@@ -1746,7 +1429,6 @@ const deserializeAws_restJson1ListUsersCommandError = async (output, context) =>
1746
1429
  ...output,
1747
1430
  body: await parseBody(output.body, context),
1748
1431
  };
1749
- let response;
1750
1432
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1751
1433
  switch (errorCode) {
1752
1434
  case "BadRequestException":
@@ -1763,25 +1445,23 @@ const deserializeAws_restJson1ListUsersCommandError = async (output, context) =>
1763
1445
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1764
1446
  default:
1765
1447
  const parsedBody = parsedOutput.body;
1766
- const $metadata = deserializeMetadata(output);
1767
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1768
- response = new MqServiceException_1.MqServiceException({
1769
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1770
- $fault: "client",
1771
- $metadata,
1448
+ (0, smithy_client_1.throwDefaultError)({
1449
+ output,
1450
+ parsedBody,
1451
+ exceptionCtor: MqServiceException_1.MqServiceException,
1452
+ errorCode,
1772
1453
  });
1773
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1774
1454
  }
1775
1455
  };
1776
1456
  const deserializeAws_restJson1RebootBrokerCommand = async (output, context) => {
1777
1457
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1778
1458
  return deserializeAws_restJson1RebootBrokerCommandError(output, context);
1779
1459
  }
1780
- const contents = {
1460
+ const contents = map({
1781
1461
  $metadata: deserializeMetadata(output),
1782
- };
1462
+ });
1783
1463
  await collectBody(output.body, context);
1784
- return Promise.resolve(contents);
1464
+ return contents;
1785
1465
  };
1786
1466
  exports.deserializeAws_restJson1RebootBrokerCommand = deserializeAws_restJson1RebootBrokerCommand;
1787
1467
  const deserializeAws_restJson1RebootBrokerCommandError = async (output, context) => {
@@ -1789,7 +1469,6 @@ const deserializeAws_restJson1RebootBrokerCommandError = async (output, context)
1789
1469
  ...output,
1790
1470
  body: await parseBody(output.body, context),
1791
1471
  };
1792
- let response;
1793
1472
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1794
1473
  switch (errorCode) {
1795
1474
  case "BadRequestException":
@@ -1806,65 +1485,53 @@ const deserializeAws_restJson1RebootBrokerCommandError = async (output, context)
1806
1485
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1807
1486
  default:
1808
1487
  const parsedBody = parsedOutput.body;
1809
- const $metadata = deserializeMetadata(output);
1810
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1811
- response = new MqServiceException_1.MqServiceException({
1812
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1813
- $fault: "client",
1814
- $metadata,
1488
+ (0, smithy_client_1.throwDefaultError)({
1489
+ output,
1490
+ parsedBody,
1491
+ exceptionCtor: MqServiceException_1.MqServiceException,
1492
+ errorCode,
1815
1493
  });
1816
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1817
1494
  }
1818
1495
  };
1819
1496
  const deserializeAws_restJson1UpdateBrokerCommand = async (output, context) => {
1820
1497
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1821
1498
  return deserializeAws_restJson1UpdateBrokerCommandError(output, context);
1822
1499
  }
1823
- const contents = {
1500
+ const contents = map({
1824
1501
  $metadata: deserializeMetadata(output),
1825
- AuthenticationStrategy: undefined,
1826
- AutoMinorVersionUpgrade: undefined,
1827
- BrokerId: undefined,
1828
- Configuration: undefined,
1829
- EngineVersion: undefined,
1830
- HostInstanceType: undefined,
1831
- LdapServerMetadata: undefined,
1832
- Logs: undefined,
1833
- MaintenanceWindowStartTime: undefined,
1834
- SecurityGroups: undefined,
1835
- };
1502
+ });
1836
1503
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1837
- if (data.authenticationStrategy !== undefined && data.authenticationStrategy !== null) {
1504
+ if (data.authenticationStrategy != null) {
1838
1505
  contents.AuthenticationStrategy = (0, smithy_client_1.expectString)(data.authenticationStrategy);
1839
1506
  }
1840
- if (data.autoMinorVersionUpgrade !== undefined && data.autoMinorVersionUpgrade !== null) {
1507
+ if (data.autoMinorVersionUpgrade != null) {
1841
1508
  contents.AutoMinorVersionUpgrade = (0, smithy_client_1.expectBoolean)(data.autoMinorVersionUpgrade);
1842
1509
  }
1843
- if (data.brokerId !== undefined && data.brokerId !== null) {
1510
+ if (data.brokerId != null) {
1844
1511
  contents.BrokerId = (0, smithy_client_1.expectString)(data.brokerId);
1845
1512
  }
1846
- if (data.configuration !== undefined && data.configuration !== null) {
1513
+ if (data.configuration != null) {
1847
1514
  contents.Configuration = deserializeAws_restJson1ConfigurationId(data.configuration, context);
1848
1515
  }
1849
- if (data.engineVersion !== undefined && data.engineVersion !== null) {
1516
+ if (data.engineVersion != null) {
1850
1517
  contents.EngineVersion = (0, smithy_client_1.expectString)(data.engineVersion);
1851
1518
  }
1852
- if (data.hostInstanceType !== undefined && data.hostInstanceType !== null) {
1519
+ if (data.hostInstanceType != null) {
1853
1520
  contents.HostInstanceType = (0, smithy_client_1.expectString)(data.hostInstanceType);
1854
1521
  }
1855
- if (data.ldapServerMetadata !== undefined && data.ldapServerMetadata !== null) {
1522
+ if (data.ldapServerMetadata != null) {
1856
1523
  contents.LdapServerMetadata = deserializeAws_restJson1LdapServerMetadataOutput(data.ldapServerMetadata, context);
1857
1524
  }
1858
- if (data.logs !== undefined && data.logs !== null) {
1525
+ if (data.logs != null) {
1859
1526
  contents.Logs = deserializeAws_restJson1Logs(data.logs, context);
1860
1527
  }
1861
- if (data.maintenanceWindowStartTime !== undefined && data.maintenanceWindowStartTime !== null) {
1528
+ if (data.maintenanceWindowStartTime != null) {
1862
1529
  contents.MaintenanceWindowStartTime = deserializeAws_restJson1WeeklyStartTime(data.maintenanceWindowStartTime, context);
1863
1530
  }
1864
- if (data.securityGroups !== undefined && data.securityGroups !== null) {
1531
+ if (data.securityGroups != null) {
1865
1532
  contents.SecurityGroups = deserializeAws_restJson1__listOf__string(data.securityGroups, context);
1866
1533
  }
1867
- return Promise.resolve(contents);
1534
+ return contents;
1868
1535
  };
1869
1536
  exports.deserializeAws_restJson1UpdateBrokerCommand = deserializeAws_restJson1UpdateBrokerCommand;
1870
1537
  const deserializeAws_restJson1UpdateBrokerCommandError = async (output, context) => {
@@ -1872,7 +1539,6 @@ const deserializeAws_restJson1UpdateBrokerCommandError = async (output, context)
1872
1539
  ...output,
1873
1540
  body: await parseBody(output.body, context),
1874
1541
  };
1875
- let response;
1876
1542
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1877
1543
  switch (errorCode) {
1878
1544
  case "BadRequestException":
@@ -1892,49 +1558,41 @@ const deserializeAws_restJson1UpdateBrokerCommandError = async (output, context)
1892
1558
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1893
1559
  default:
1894
1560
  const parsedBody = parsedOutput.body;
1895
- const $metadata = deserializeMetadata(output);
1896
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1897
- response = new MqServiceException_1.MqServiceException({
1898
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1899
- $fault: "client",
1900
- $metadata,
1561
+ (0, smithy_client_1.throwDefaultError)({
1562
+ output,
1563
+ parsedBody,
1564
+ exceptionCtor: MqServiceException_1.MqServiceException,
1565
+ errorCode,
1901
1566
  });
1902
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1903
1567
  }
1904
1568
  };
1905
1569
  const deserializeAws_restJson1UpdateConfigurationCommand = async (output, context) => {
1906
1570
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1907
1571
  return deserializeAws_restJson1UpdateConfigurationCommandError(output, context);
1908
1572
  }
1909
- const contents = {
1573
+ const contents = map({
1910
1574
  $metadata: deserializeMetadata(output),
1911
- Arn: undefined,
1912
- Created: undefined,
1913
- Id: undefined,
1914
- LatestRevision: undefined,
1915
- Name: undefined,
1916
- Warnings: undefined,
1917
- };
1575
+ });
1918
1576
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1919
- if (data.arn !== undefined && data.arn !== null) {
1577
+ if (data.arn != null) {
1920
1578
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1921
1579
  }
1922
- if (data.created !== undefined && data.created !== null) {
1580
+ if (data.created != null) {
1923
1581
  contents.Created = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.created));
1924
1582
  }
1925
- if (data.id !== undefined && data.id !== null) {
1583
+ if (data.id != null) {
1926
1584
  contents.Id = (0, smithy_client_1.expectString)(data.id);
1927
1585
  }
1928
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
1586
+ if (data.latestRevision != null) {
1929
1587
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
1930
1588
  }
1931
- if (data.name !== undefined && data.name !== null) {
1589
+ if (data.name != null) {
1932
1590
  contents.Name = (0, smithy_client_1.expectString)(data.name);
1933
1591
  }
1934
- if (data.warnings !== undefined && data.warnings !== null) {
1592
+ if (data.warnings != null) {
1935
1593
  contents.Warnings = deserializeAws_restJson1__listOfSanitizationWarning(data.warnings, context);
1936
1594
  }
1937
- return Promise.resolve(contents);
1595
+ return contents;
1938
1596
  };
1939
1597
  exports.deserializeAws_restJson1UpdateConfigurationCommand = deserializeAws_restJson1UpdateConfigurationCommand;
1940
1598
  const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, context) => {
@@ -1942,7 +1600,6 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
1942
1600
  ...output,
1943
1601
  body: await parseBody(output.body, context),
1944
1602
  };
1945
- let response;
1946
1603
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1947
1604
  switch (errorCode) {
1948
1605
  case "BadRequestException":
@@ -1962,25 +1619,23 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
1962
1619
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1963
1620
  default:
1964
1621
  const parsedBody = parsedOutput.body;
1965
- const $metadata = deserializeMetadata(output);
1966
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1967
- response = new MqServiceException_1.MqServiceException({
1968
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1969
- $fault: "client",
1970
- $metadata,
1622
+ (0, smithy_client_1.throwDefaultError)({
1623
+ output,
1624
+ parsedBody,
1625
+ exceptionCtor: MqServiceException_1.MqServiceException,
1626
+ errorCode,
1971
1627
  });
1972
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1973
1628
  }
1974
1629
  };
1975
1630
  const deserializeAws_restJson1UpdateUserCommand = async (output, context) => {
1976
1631
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1977
1632
  return deserializeAws_restJson1UpdateUserCommandError(output, context);
1978
1633
  }
1979
- const contents = {
1634
+ const contents = map({
1980
1635
  $metadata: deserializeMetadata(output),
1981
- };
1636
+ });
1982
1637
  await collectBody(output.body, context);
1983
- return Promise.resolve(contents);
1638
+ return contents;
1984
1639
  };
1985
1640
  exports.deserializeAws_restJson1UpdateUserCommand = deserializeAws_restJson1UpdateUserCommand;
1986
1641
  const deserializeAws_restJson1UpdateUserCommandError = async (output, context) => {
@@ -1988,7 +1643,6 @@ const deserializeAws_restJson1UpdateUserCommandError = async (output, context) =
1988
1643
  ...output,
1989
1644
  body: await parseBody(output.body, context),
1990
1645
  };
1991
- let response;
1992
1646
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1993
1647
  switch (errorCode) {
1994
1648
  case "BadRequestException":
@@ -2008,23 +1662,22 @@ const deserializeAws_restJson1UpdateUserCommandError = async (output, context) =
2008
1662
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2009
1663
  default:
2010
1664
  const parsedBody = parsedOutput.body;
2011
- const $metadata = deserializeMetadata(output);
2012
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2013
- response = new MqServiceException_1.MqServiceException({
2014
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2015
- $fault: "client",
2016
- $metadata,
1665
+ (0, smithy_client_1.throwDefaultError)({
1666
+ output,
1667
+ parsedBody,
1668
+ exceptionCtor: MqServiceException_1.MqServiceException,
1669
+ errorCode,
2017
1670
  });
2018
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2019
1671
  }
2020
1672
  };
1673
+ const map = smithy_client_1.map;
2021
1674
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
2022
- const contents = {};
1675
+ const contents = map({});
2023
1676
  const data = parsedOutput.body;
2024
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1677
+ if (data.errorAttribute != null) {
2025
1678
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2026
1679
  }
2027
- if (data.message !== undefined && data.message !== null) {
1680
+ if (data.message != null) {
2028
1681
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2029
1682
  }
2030
1683
  const exception = new models_0_1.BadRequestException({
@@ -2034,12 +1687,12 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
2034
1687
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2035
1688
  };
2036
1689
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2037
- const contents = {};
1690
+ const contents = map({});
2038
1691
  const data = parsedOutput.body;
2039
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1692
+ if (data.errorAttribute != null) {
2040
1693
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2041
1694
  }
2042
- if (data.message !== undefined && data.message !== null) {
1695
+ if (data.message != null) {
2043
1696
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2044
1697
  }
2045
1698
  const exception = new models_0_1.ConflictException({
@@ -2049,12 +1702,12 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2049
1702
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2050
1703
  };
2051
1704
  const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput, context) => {
2052
- const contents = {};
1705
+ const contents = map({});
2053
1706
  const data = parsedOutput.body;
2054
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1707
+ if (data.errorAttribute != null) {
2055
1708
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2056
1709
  }
2057
- if (data.message !== undefined && data.message !== null) {
1710
+ if (data.message != null) {
2058
1711
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2059
1712
  }
2060
1713
  const exception = new models_0_1.ForbiddenException({
@@ -2064,12 +1717,12 @@ const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput,
2064
1717
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2065
1718
  };
2066
1719
  const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (parsedOutput, context) => {
2067
- const contents = {};
1720
+ const contents = map({});
2068
1721
  const data = parsedOutput.body;
2069
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1722
+ if (data.errorAttribute != null) {
2070
1723
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2071
1724
  }
2072
- if (data.message !== undefined && data.message !== null) {
1725
+ if (data.message != null) {
2073
1726
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2074
1727
  }
2075
1728
  const exception = new models_0_1.InternalServerErrorException({
@@ -2079,12 +1732,12 @@ const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (pars
2079
1732
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2080
1733
  };
2081
1734
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
2082
- const contents = {};
1735
+ const contents = map({});
2083
1736
  const data = parsedOutput.body;
2084
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1737
+ if (data.errorAttribute != null) {
2085
1738
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2086
1739
  }
2087
- if (data.message !== undefined && data.message !== null) {
1740
+ if (data.message != null) {
2088
1741
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2089
1742
  }
2090
1743
  const exception = new models_0_1.NotFoundException({
@@ -2094,12 +1747,12 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
2094
1747
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2095
1748
  };
2096
1749
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
2097
- const contents = {};
1750
+ const contents = map({});
2098
1751
  const data = parsedOutput.body;
2099
- if (data.errorAttribute !== undefined && data.errorAttribute !== null) {
1752
+ if (data.errorAttribute != null) {
2100
1753
  contents.ErrorAttribute = (0, smithy_client_1.expectString)(data.errorAttribute);
2101
1754
  }
2102
- if (data.message !== undefined && data.message !== null) {
1755
+ if (data.message != null) {
2103
1756
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2104
1757
  }
2105
1758
  const exception = new models_0_1.UnauthorizedException({
@@ -2112,9 +1765,6 @@ const serializeAws_restJson1__listOf__string = (input, context) => {
2112
1765
  return input
2113
1766
  .filter((e) => e != null)
2114
1767
  .map((entry) => {
2115
- if (entry === null) {
2116
- return null;
2117
- }
2118
1768
  return entry;
2119
1769
  });
2120
1770
  };
@@ -2122,9 +1772,6 @@ const serializeAws_restJson1__listOfUser = (input, context) => {
2122
1772
  return input
2123
1773
  .filter((e) => e != null)
2124
1774
  .map((entry) => {
2125
- if (entry === null) {
2126
- return null;
2127
- }
2128
1775
  return serializeAws_restJson1User(entry, context);
2129
1776
  });
2130
1777
  };