@aws-sdk/client-iotsecuretunneling 3.180.0 → 3.183.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.
@@ -1,576 +1,453 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { IoTSecureTunnelingServiceException as __BaseException } from "../models/IoTSecureTunnelingServiceException";
5
4
  import { LimitExceededException, ResourceNotFoundException, } from "../models/models_0";
6
- export var serializeAws_json1_1CloseTunnelCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var headers, body;
8
- return __generator(this, function (_a) {
9
- headers = {
10
- "content-type": "application/x-amz-json-1.1",
11
- "x-amz-target": "IoTSecuredTunneling.CloseTunnel",
12
- };
13
- body = JSON.stringify(serializeAws_json1_1CloseTunnelRequest(input, context));
14
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
15
- });
16
- }); };
17
- export var serializeAws_json1_1DescribeTunnelCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
18
- var headers, body;
19
- return __generator(this, function (_a) {
20
- headers = {
21
- "content-type": "application/x-amz-json-1.1",
22
- "x-amz-target": "IoTSecuredTunneling.DescribeTunnel",
23
- };
24
- body = JSON.stringify(serializeAws_json1_1DescribeTunnelRequest(input, context));
25
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
26
- });
27
- }); };
28
- export var serializeAws_json1_1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
- var headers, body;
30
- return __generator(this, function (_a) {
31
- headers = {
32
- "content-type": "application/x-amz-json-1.1",
33
- "x-amz-target": "IoTSecuredTunneling.ListTagsForResource",
34
- };
35
- body = JSON.stringify(serializeAws_json1_1ListTagsForResourceRequest(input, context));
36
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
37
- });
38
- }); };
39
- export var serializeAws_json1_1ListTunnelsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
40
- var headers, body;
41
- return __generator(this, function (_a) {
42
- headers = {
43
- "content-type": "application/x-amz-json-1.1",
44
- "x-amz-target": "IoTSecuredTunneling.ListTunnels",
45
- };
46
- body = JSON.stringify(serializeAws_json1_1ListTunnelsRequest(input, context));
47
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
48
- });
49
- }); };
50
- export var serializeAws_json1_1OpenTunnelCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
51
- var headers, body;
52
- return __generator(this, function (_a) {
53
- headers = {
54
- "content-type": "application/x-amz-json-1.1",
55
- "x-amz-target": "IoTSecuredTunneling.OpenTunnel",
56
- };
57
- body = JSON.stringify(serializeAws_json1_1OpenTunnelRequest(input, context));
58
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
59
- });
60
- }); };
61
- export var serializeAws_json1_1RotateTunnelAccessTokenCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
62
- var headers, body;
63
- return __generator(this, function (_a) {
64
- headers = {
65
- "content-type": "application/x-amz-json-1.1",
66
- "x-amz-target": "IoTSecuredTunneling.RotateTunnelAccessToken",
67
- };
68
- body = JSON.stringify(serializeAws_json1_1RotateTunnelAccessTokenRequest(input, context));
69
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
70
- });
71
- }); };
72
- export var serializeAws_json1_1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
73
- var headers, body;
74
- return __generator(this, function (_a) {
75
- headers = {
76
- "content-type": "application/x-amz-json-1.1",
77
- "x-amz-target": "IoTSecuredTunneling.TagResource",
78
- };
79
- body = JSON.stringify(serializeAws_json1_1TagResourceRequest(input, context));
80
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
81
- });
82
- }); };
83
- export var serializeAws_json1_1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
84
- var headers, body;
85
- return __generator(this, function (_a) {
86
- headers = {
87
- "content-type": "application/x-amz-json-1.1",
88
- "x-amz-target": "IoTSecuredTunneling.UntagResource",
89
- };
90
- body = JSON.stringify(serializeAws_json1_1UntagResourceRequest(input, context));
91
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
92
- });
93
- }); };
94
- export var deserializeAws_json1_1CloseTunnelCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
95
- var data, contents, response;
96
- return __generator(this, function (_a) {
97
- switch (_a.label) {
98
- case 0:
99
- if (output.statusCode >= 300) {
100
- return [2, deserializeAws_json1_1CloseTunnelCommandError(output, context)];
101
- }
102
- return [4, parseBody(output.body, context)];
103
- case 1:
104
- data = _a.sent();
105
- contents = {};
106
- contents = deserializeAws_json1_1CloseTunnelResponse(data, context);
107
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
108
- return [2, Promise.resolve(response)];
109
- }
110
- });
111
- }); };
112
- var deserializeAws_json1_1CloseTunnelCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
113
- var parsedOutput, _a, errorCode, _b, parsedBody;
114
- var _c;
115
- return __generator(this, function (_d) {
116
- switch (_d.label) {
117
- case 0:
118
- _a = [__assign({}, output)];
119
- _c = {};
120
- return [4, parseBody(output.body, context)];
121
- case 1:
122
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
123
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
124
- _b = errorCode;
125
- switch (_b) {
126
- case "ResourceNotFoundException": return [3, 2];
127
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
128
- }
129
- return [3, 4];
130
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
131
- case 3: throw _d.sent();
132
- case 4:
133
- parsedBody = parsedOutput.body;
134
- throwDefaultError({
135
- output: output,
136
- parsedBody: parsedBody,
137
- exceptionCtor: __BaseException,
138
- errorCode: errorCode,
139
- });
140
- _d.label = 5;
141
- case 5: return [2];
142
- }
143
- });
144
- }); };
145
- export var deserializeAws_json1_1DescribeTunnelCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
146
- var data, contents, response;
147
- return __generator(this, function (_a) {
148
- switch (_a.label) {
149
- case 0:
150
- if (output.statusCode >= 300) {
151
- return [2, deserializeAws_json1_1DescribeTunnelCommandError(output, context)];
152
- }
153
- return [4, parseBody(output.body, context)];
154
- case 1:
155
- data = _a.sent();
156
- contents = {};
157
- contents = deserializeAws_json1_1DescribeTunnelResponse(data, context);
158
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
159
- return [2, Promise.resolve(response)];
160
- }
161
- });
162
- }); };
163
- var deserializeAws_json1_1DescribeTunnelCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
164
- var parsedOutput, _a, errorCode, _b, parsedBody;
165
- var _c;
166
- return __generator(this, function (_d) {
167
- switch (_d.label) {
168
- case 0:
169
- _a = [__assign({}, output)];
170
- _c = {};
171
- return [4, parseBody(output.body, context)];
172
- case 1:
173
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
174
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
175
- _b = errorCode;
176
- switch (_b) {
177
- case "ResourceNotFoundException": return [3, 2];
178
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
179
- }
180
- return [3, 4];
181
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
182
- case 3: throw _d.sent();
183
- case 4:
184
- parsedBody = parsedOutput.body;
185
- throwDefaultError({
186
- output: output,
187
- parsedBody: parsedBody,
188
- exceptionCtor: __BaseException,
189
- errorCode: errorCode,
190
- });
191
- _d.label = 5;
192
- case 5: return [2];
193
- }
194
- });
195
- }); };
196
- export var deserializeAws_json1_1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
197
- var data, contents, response;
198
- return __generator(this, function (_a) {
199
- switch (_a.label) {
200
- case 0:
201
- if (output.statusCode >= 300) {
202
- return [2, deserializeAws_json1_1ListTagsForResourceCommandError(output, context)];
203
- }
204
- return [4, parseBody(output.body, context)];
205
- case 1:
206
- data = _a.sent();
207
- contents = {};
208
- contents = deserializeAws_json1_1ListTagsForResourceResponse(data, context);
209
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
210
- return [2, Promise.resolve(response)];
211
- }
212
- });
213
- }); };
214
- var deserializeAws_json1_1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
215
- var parsedOutput, _a, errorCode, _b, parsedBody;
216
- var _c;
217
- return __generator(this, function (_d) {
218
- switch (_d.label) {
219
- case 0:
220
- _a = [__assign({}, output)];
221
- _c = {};
222
- return [4, parseBody(output.body, context)];
223
- case 1:
224
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
225
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
226
- _b = errorCode;
227
- switch (_b) {
228
- case "ResourceNotFoundException": return [3, 2];
229
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
230
- }
231
- return [3, 4];
232
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
233
- case 3: throw _d.sent();
234
- case 4:
235
- parsedBody = parsedOutput.body;
236
- throwDefaultError({
237
- output: output,
238
- parsedBody: parsedBody,
239
- exceptionCtor: __BaseException,
240
- errorCode: errorCode,
241
- });
242
- _d.label = 5;
243
- case 5: return [2];
244
- }
245
- });
246
- }); };
247
- export var deserializeAws_json1_1ListTunnelsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
248
- var data, contents, response;
249
- return __generator(this, function (_a) {
250
- switch (_a.label) {
251
- case 0:
252
- if (output.statusCode >= 300) {
253
- return [2, deserializeAws_json1_1ListTunnelsCommandError(output, context)];
254
- }
255
- return [4, parseBody(output.body, context)];
256
- case 1:
257
- data = _a.sent();
258
- contents = {};
259
- contents = deserializeAws_json1_1ListTunnelsResponse(data, context);
260
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
261
- return [2, Promise.resolve(response)];
262
- }
263
- });
264
- }); };
265
- var deserializeAws_json1_1ListTunnelsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
266
- var parsedOutput, _a, errorCode, parsedBody;
267
- var _b;
268
- return __generator(this, function (_c) {
269
- switch (_c.label) {
270
- case 0:
271
- _a = [__assign({}, output)];
272
- _b = {};
273
- return [4, parseBody(output.body, context)];
274
- case 1:
275
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
276
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
277
- parsedBody = parsedOutput.body;
278
- throwDefaultError({
279
- output: output,
280
- parsedBody: parsedBody,
281
- exceptionCtor: __BaseException,
282
- errorCode: errorCode,
283
- });
284
- return [2];
285
- }
286
- });
287
- }); };
288
- export var deserializeAws_json1_1OpenTunnelCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
289
- var data, contents, response;
290
- return __generator(this, function (_a) {
291
- switch (_a.label) {
292
- case 0:
293
- if (output.statusCode >= 300) {
294
- return [2, deserializeAws_json1_1OpenTunnelCommandError(output, context)];
295
- }
296
- return [4, parseBody(output.body, context)];
297
- case 1:
298
- data = _a.sent();
299
- contents = {};
300
- contents = deserializeAws_json1_1OpenTunnelResponse(data, context);
301
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
302
- return [2, Promise.resolve(response)];
303
- }
304
- });
305
- }); };
306
- var deserializeAws_json1_1OpenTunnelCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
307
- var parsedOutput, _a, errorCode, _b, parsedBody;
308
- var _c;
309
- return __generator(this, function (_d) {
310
- switch (_d.label) {
311
- case 0:
312
- _a = [__assign({}, output)];
313
- _c = {};
314
- return [4, parseBody(output.body, context)];
315
- case 1:
316
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
317
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
318
- _b = errorCode;
319
- switch (_b) {
320
- case "LimitExceededException": return [3, 2];
321
- case "com.amazonaws.iotsecuretunneling#LimitExceededException": return [3, 2];
322
- }
323
- return [3, 4];
324
- case 2: return [4, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
325
- case 3: throw _d.sent();
326
- case 4:
327
- parsedBody = parsedOutput.body;
328
- throwDefaultError({
329
- output: output,
330
- parsedBody: parsedBody,
331
- exceptionCtor: __BaseException,
332
- errorCode: errorCode,
333
- });
334
- _d.label = 5;
335
- case 5: return [2];
336
- }
337
- });
338
- }); };
339
- export var deserializeAws_json1_1RotateTunnelAccessTokenCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
340
- var data, contents, response;
341
- return __generator(this, function (_a) {
342
- switch (_a.label) {
343
- case 0:
344
- if (output.statusCode >= 300) {
345
- return [2, deserializeAws_json1_1RotateTunnelAccessTokenCommandError(output, context)];
346
- }
347
- return [4, parseBody(output.body, context)];
348
- case 1:
349
- data = _a.sent();
350
- contents = {};
351
- contents = deserializeAws_json1_1RotateTunnelAccessTokenResponse(data, context);
352
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
353
- return [2, Promise.resolve(response)];
354
- }
355
- });
356
- }); };
357
- var deserializeAws_json1_1RotateTunnelAccessTokenCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
358
- var parsedOutput, _a, errorCode, _b, parsedBody;
359
- var _c;
360
- return __generator(this, function (_d) {
361
- switch (_d.label) {
362
- case 0:
363
- _a = [__assign({}, output)];
364
- _c = {};
365
- return [4, parseBody(output.body, context)];
366
- case 1:
367
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
368
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
369
- _b = errorCode;
370
- switch (_b) {
371
- case "ResourceNotFoundException": return [3, 2];
372
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
373
- }
374
- return [3, 4];
375
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
376
- case 3: throw _d.sent();
377
- case 4:
378
- parsedBody = parsedOutput.body;
379
- throwDefaultError({
380
- output: output,
381
- parsedBody: parsedBody,
382
- exceptionCtor: __BaseException,
383
- errorCode: errorCode,
384
- });
385
- _d.label = 5;
386
- case 5: return [2];
387
- }
388
- });
389
- }); };
390
- export var deserializeAws_json1_1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
391
- var data, contents, response;
392
- return __generator(this, function (_a) {
393
- switch (_a.label) {
394
- case 0:
395
- if (output.statusCode >= 300) {
396
- return [2, deserializeAws_json1_1TagResourceCommandError(output, context)];
397
- }
398
- return [4, parseBody(output.body, context)];
399
- case 1:
400
- data = _a.sent();
401
- contents = {};
402
- contents = deserializeAws_json1_1TagResourceResponse(data, context);
403
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
404
- return [2, Promise.resolve(response)];
405
- }
406
- });
407
- }); };
408
- var deserializeAws_json1_1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
409
- var parsedOutput, _a, errorCode, _b, parsedBody;
410
- var _c;
411
- return __generator(this, function (_d) {
412
- switch (_d.label) {
413
- case 0:
414
- _a = [__assign({}, output)];
415
- _c = {};
416
- return [4, parseBody(output.body, context)];
417
- case 1:
418
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
419
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
420
- _b = errorCode;
421
- switch (_b) {
422
- case "ResourceNotFoundException": return [3, 2];
423
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
424
- }
425
- return [3, 4];
426
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
427
- case 3: throw _d.sent();
428
- case 4:
429
- parsedBody = parsedOutput.body;
430
- throwDefaultError({
431
- output: output,
432
- parsedBody: parsedBody,
433
- exceptionCtor: __BaseException,
434
- errorCode: errorCode,
435
- });
436
- _d.label = 5;
437
- case 5: return [2];
438
- }
439
- });
440
- }); };
441
- export var deserializeAws_json1_1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
442
- var data, contents, response;
443
- return __generator(this, function (_a) {
444
- switch (_a.label) {
445
- case 0:
446
- if (output.statusCode >= 300) {
447
- return [2, deserializeAws_json1_1UntagResourceCommandError(output, context)];
448
- }
449
- return [4, parseBody(output.body, context)];
450
- case 1:
451
- data = _a.sent();
452
- contents = {};
453
- contents = deserializeAws_json1_1UntagResourceResponse(data, context);
454
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
455
- return [2, Promise.resolve(response)];
456
- }
457
- });
458
- }); };
459
- var deserializeAws_json1_1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
460
- var parsedOutput, _a, errorCode, _b, parsedBody;
461
- var _c;
462
- return __generator(this, function (_d) {
463
- switch (_d.label) {
464
- case 0:
465
- _a = [__assign({}, output)];
466
- _c = {};
467
- return [4, parseBody(output.body, context)];
468
- case 1:
469
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
470
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
471
- _b = errorCode;
472
- switch (_b) {
473
- case "ResourceNotFoundException": return [3, 2];
474
- case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException": return [3, 2];
475
- }
476
- return [3, 4];
477
- case 2: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
478
- case 3: throw _d.sent();
479
- case 4:
480
- parsedBody = parsedOutput.body;
481
- throwDefaultError({
482
- output: output,
483
- parsedBody: parsedBody,
484
- exceptionCtor: __BaseException,
485
- errorCode: errorCode,
486
- });
487
- _d.label = 5;
488
- case 5: return [2];
489
- }
490
- });
491
- }); };
492
- var deserializeAws_json1_1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
493
- var body, deserialized, exception;
494
- return __generator(this, function (_a) {
495
- body = parsedOutput.body;
496
- deserialized = deserializeAws_json1_1LimitExceededException(body, context);
497
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
498
- return [2, __decorateServiceException(exception, body)];
5
+ export const serializeAws_json1_1CloseTunnelCommand = async (input, context) => {
6
+ const headers = {
7
+ "content-type": "application/x-amz-json-1.1",
8
+ "x-amz-target": "IoTSecuredTunneling.CloseTunnel",
9
+ };
10
+ let body;
11
+ body = JSON.stringify(serializeAws_json1_1CloseTunnelRequest(input, context));
12
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
+ };
14
+ export const serializeAws_json1_1DescribeTunnelCommand = async (input, context) => {
15
+ const headers = {
16
+ "content-type": "application/x-amz-json-1.1",
17
+ "x-amz-target": "IoTSecuredTunneling.DescribeTunnel",
18
+ };
19
+ let body;
20
+ body = JSON.stringify(serializeAws_json1_1DescribeTunnelRequest(input, context));
21
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
+ };
23
+ export const serializeAws_json1_1ListTagsForResourceCommand = async (input, context) => {
24
+ const headers = {
25
+ "content-type": "application/x-amz-json-1.1",
26
+ "x-amz-target": "IoTSecuredTunneling.ListTagsForResource",
27
+ };
28
+ let body;
29
+ body = JSON.stringify(serializeAws_json1_1ListTagsForResourceRequest(input, context));
30
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
31
+ };
32
+ export const serializeAws_json1_1ListTunnelsCommand = async (input, context) => {
33
+ const headers = {
34
+ "content-type": "application/x-amz-json-1.1",
35
+ "x-amz-target": "IoTSecuredTunneling.ListTunnels",
36
+ };
37
+ let body;
38
+ body = JSON.stringify(serializeAws_json1_1ListTunnelsRequest(input, context));
39
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
40
+ };
41
+ export const serializeAws_json1_1OpenTunnelCommand = async (input, context) => {
42
+ const headers = {
43
+ "content-type": "application/x-amz-json-1.1",
44
+ "x-amz-target": "IoTSecuredTunneling.OpenTunnel",
45
+ };
46
+ let body;
47
+ body = JSON.stringify(serializeAws_json1_1OpenTunnelRequest(input, context));
48
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
49
+ };
50
+ export const serializeAws_json1_1RotateTunnelAccessTokenCommand = async (input, context) => {
51
+ const headers = {
52
+ "content-type": "application/x-amz-json-1.1",
53
+ "x-amz-target": "IoTSecuredTunneling.RotateTunnelAccessToken",
54
+ };
55
+ let body;
56
+ body = JSON.stringify(serializeAws_json1_1RotateTunnelAccessTokenRequest(input, context));
57
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
58
+ };
59
+ export const serializeAws_json1_1TagResourceCommand = async (input, context) => {
60
+ const headers = {
61
+ "content-type": "application/x-amz-json-1.1",
62
+ "x-amz-target": "IoTSecuredTunneling.TagResource",
63
+ };
64
+ let body;
65
+ body = JSON.stringify(serializeAws_json1_1TagResourceRequest(input, context));
66
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
67
+ };
68
+ export const serializeAws_json1_1UntagResourceCommand = async (input, context) => {
69
+ const headers = {
70
+ "content-type": "application/x-amz-json-1.1",
71
+ "x-amz-target": "IoTSecuredTunneling.UntagResource",
72
+ };
73
+ let body;
74
+ body = JSON.stringify(serializeAws_json1_1UntagResourceRequest(input, context));
75
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
76
+ };
77
+ export const deserializeAws_json1_1CloseTunnelCommand = async (output, context) => {
78
+ if (output.statusCode >= 300) {
79
+ return deserializeAws_json1_1CloseTunnelCommandError(output, context);
80
+ }
81
+ const data = await parseBody(output.body, context);
82
+ let contents = {};
83
+ contents = deserializeAws_json1_1CloseTunnelResponse(data, context);
84
+ const response = {
85
+ $metadata: deserializeMetadata(output),
86
+ ...contents,
87
+ };
88
+ return Promise.resolve(response);
89
+ };
90
+ const deserializeAws_json1_1CloseTunnelCommandError = async (output, context) => {
91
+ const parsedOutput = {
92
+ ...output,
93
+ body: await parseErrorBody(output.body, context),
94
+ };
95
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
96
+ switch (errorCode) {
97
+ case "ResourceNotFoundException":
98
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
99
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
100
+ default:
101
+ const parsedBody = parsedOutput.body;
102
+ throwDefaultError({
103
+ output,
104
+ parsedBody,
105
+ exceptionCtor: __BaseException,
106
+ errorCode,
107
+ });
108
+ }
109
+ };
110
+ export const deserializeAws_json1_1DescribeTunnelCommand = async (output, context) => {
111
+ if (output.statusCode >= 300) {
112
+ return deserializeAws_json1_1DescribeTunnelCommandError(output, context);
113
+ }
114
+ const data = await parseBody(output.body, context);
115
+ let contents = {};
116
+ contents = deserializeAws_json1_1DescribeTunnelResponse(data, context);
117
+ const response = {
118
+ $metadata: deserializeMetadata(output),
119
+ ...contents,
120
+ };
121
+ return Promise.resolve(response);
122
+ };
123
+ const deserializeAws_json1_1DescribeTunnelCommandError = async (output, context) => {
124
+ const parsedOutput = {
125
+ ...output,
126
+ body: await parseErrorBody(output.body, context),
127
+ };
128
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
129
+ switch (errorCode) {
130
+ case "ResourceNotFoundException":
131
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
132
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
133
+ default:
134
+ const parsedBody = parsedOutput.body;
135
+ throwDefaultError({
136
+ output,
137
+ parsedBody,
138
+ exceptionCtor: __BaseException,
139
+ errorCode,
140
+ });
141
+ }
142
+ };
143
+ export const deserializeAws_json1_1ListTagsForResourceCommand = async (output, context) => {
144
+ if (output.statusCode >= 300) {
145
+ return deserializeAws_json1_1ListTagsForResourceCommandError(output, context);
146
+ }
147
+ const data = await parseBody(output.body, context);
148
+ let contents = {};
149
+ contents = deserializeAws_json1_1ListTagsForResourceResponse(data, context);
150
+ const response = {
151
+ $metadata: deserializeMetadata(output),
152
+ ...contents,
153
+ };
154
+ return Promise.resolve(response);
155
+ };
156
+ const deserializeAws_json1_1ListTagsForResourceCommandError = async (output, context) => {
157
+ const parsedOutput = {
158
+ ...output,
159
+ body: await parseErrorBody(output.body, context),
160
+ };
161
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
162
+ switch (errorCode) {
163
+ case "ResourceNotFoundException":
164
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
165
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
166
+ default:
167
+ const parsedBody = parsedOutput.body;
168
+ throwDefaultError({
169
+ output,
170
+ parsedBody,
171
+ exceptionCtor: __BaseException,
172
+ errorCode,
173
+ });
174
+ }
175
+ };
176
+ export const deserializeAws_json1_1ListTunnelsCommand = async (output, context) => {
177
+ if (output.statusCode >= 300) {
178
+ return deserializeAws_json1_1ListTunnelsCommandError(output, context);
179
+ }
180
+ const data = await parseBody(output.body, context);
181
+ let contents = {};
182
+ contents = deserializeAws_json1_1ListTunnelsResponse(data, context);
183
+ const response = {
184
+ $metadata: deserializeMetadata(output),
185
+ ...contents,
186
+ };
187
+ return Promise.resolve(response);
188
+ };
189
+ const deserializeAws_json1_1ListTunnelsCommandError = async (output, context) => {
190
+ const parsedOutput = {
191
+ ...output,
192
+ body: await parseErrorBody(output.body, context),
193
+ };
194
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
195
+ const parsedBody = parsedOutput.body;
196
+ throwDefaultError({
197
+ output,
198
+ parsedBody,
199
+ exceptionCtor: __BaseException,
200
+ errorCode,
201
+ });
202
+ };
203
+ export const deserializeAws_json1_1OpenTunnelCommand = async (output, context) => {
204
+ if (output.statusCode >= 300) {
205
+ return deserializeAws_json1_1OpenTunnelCommandError(output, context);
206
+ }
207
+ const data = await parseBody(output.body, context);
208
+ let contents = {};
209
+ contents = deserializeAws_json1_1OpenTunnelResponse(data, context);
210
+ const response = {
211
+ $metadata: deserializeMetadata(output),
212
+ ...contents,
213
+ };
214
+ return Promise.resolve(response);
215
+ };
216
+ const deserializeAws_json1_1OpenTunnelCommandError = async (output, context) => {
217
+ const parsedOutput = {
218
+ ...output,
219
+ body: await parseErrorBody(output.body, context),
220
+ };
221
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
222
+ switch (errorCode) {
223
+ case "LimitExceededException":
224
+ case "com.amazonaws.iotsecuretunneling#LimitExceededException":
225
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
226
+ default:
227
+ const parsedBody = parsedOutput.body;
228
+ throwDefaultError({
229
+ output,
230
+ parsedBody,
231
+ exceptionCtor: __BaseException,
232
+ errorCode,
233
+ });
234
+ }
235
+ };
236
+ export const deserializeAws_json1_1RotateTunnelAccessTokenCommand = async (output, context) => {
237
+ if (output.statusCode >= 300) {
238
+ return deserializeAws_json1_1RotateTunnelAccessTokenCommandError(output, context);
239
+ }
240
+ const data = await parseBody(output.body, context);
241
+ let contents = {};
242
+ contents = deserializeAws_json1_1RotateTunnelAccessTokenResponse(data, context);
243
+ const response = {
244
+ $metadata: deserializeMetadata(output),
245
+ ...contents,
246
+ };
247
+ return Promise.resolve(response);
248
+ };
249
+ const deserializeAws_json1_1RotateTunnelAccessTokenCommandError = async (output, context) => {
250
+ const parsedOutput = {
251
+ ...output,
252
+ body: await parseErrorBody(output.body, context),
253
+ };
254
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
255
+ switch (errorCode) {
256
+ case "ResourceNotFoundException":
257
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
258
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
259
+ default:
260
+ const parsedBody = parsedOutput.body;
261
+ throwDefaultError({
262
+ output,
263
+ parsedBody,
264
+ exceptionCtor: __BaseException,
265
+ errorCode,
266
+ });
267
+ }
268
+ };
269
+ export const deserializeAws_json1_1TagResourceCommand = async (output, context) => {
270
+ if (output.statusCode >= 300) {
271
+ return deserializeAws_json1_1TagResourceCommandError(output, context);
272
+ }
273
+ const data = await parseBody(output.body, context);
274
+ let contents = {};
275
+ contents = deserializeAws_json1_1TagResourceResponse(data, context);
276
+ const response = {
277
+ $metadata: deserializeMetadata(output),
278
+ ...contents,
279
+ };
280
+ return Promise.resolve(response);
281
+ };
282
+ const deserializeAws_json1_1TagResourceCommandError = async (output, context) => {
283
+ const parsedOutput = {
284
+ ...output,
285
+ body: await parseErrorBody(output.body, context),
286
+ };
287
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
288
+ switch (errorCode) {
289
+ case "ResourceNotFoundException":
290
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
291
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
292
+ default:
293
+ const parsedBody = parsedOutput.body;
294
+ throwDefaultError({
295
+ output,
296
+ parsedBody,
297
+ exceptionCtor: __BaseException,
298
+ errorCode,
299
+ });
300
+ }
301
+ };
302
+ export const deserializeAws_json1_1UntagResourceCommand = async (output, context) => {
303
+ if (output.statusCode >= 300) {
304
+ return deserializeAws_json1_1UntagResourceCommandError(output, context);
305
+ }
306
+ const data = await parseBody(output.body, context);
307
+ let contents = {};
308
+ contents = deserializeAws_json1_1UntagResourceResponse(data, context);
309
+ const response = {
310
+ $metadata: deserializeMetadata(output),
311
+ ...contents,
312
+ };
313
+ return Promise.resolve(response);
314
+ };
315
+ const deserializeAws_json1_1UntagResourceCommandError = async (output, context) => {
316
+ const parsedOutput = {
317
+ ...output,
318
+ body: await parseErrorBody(output.body, context),
319
+ };
320
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
321
+ switch (errorCode) {
322
+ case "ResourceNotFoundException":
323
+ case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
324
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
325
+ default:
326
+ const parsedBody = parsedOutput.body;
327
+ throwDefaultError({
328
+ output,
329
+ parsedBody,
330
+ exceptionCtor: __BaseException,
331
+ errorCode,
332
+ });
333
+ }
334
+ };
335
+ const deserializeAws_json1_1LimitExceededExceptionResponse = async (parsedOutput, context) => {
336
+ const body = parsedOutput.body;
337
+ const deserialized = deserializeAws_json1_1LimitExceededException(body, context);
338
+ const exception = new LimitExceededException({
339
+ $metadata: deserializeMetadata(parsedOutput),
340
+ ...deserialized,
499
341
  });
500
- }); };
501
- var deserializeAws_json1_1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
502
- var body, deserialized, exception;
503
- return __generator(this, function (_a) {
504
- body = parsedOutput.body;
505
- deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
506
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
507
- return [2, __decorateServiceException(exception, body)];
342
+ return __decorateServiceException(exception, body);
343
+ };
344
+ const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
345
+ const body = parsedOutput.body;
346
+ const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
347
+ const exception = new ResourceNotFoundException({
348
+ $metadata: deserializeMetadata(parsedOutput),
349
+ ...deserialized,
508
350
  });
509
- }); };
510
- var serializeAws_json1_1CloseTunnelRequest = function (input, context) {
511
- return __assign(__assign({}, (input.delete != null && { delete: input.delete })), (input.tunnelId != null && { tunnelId: input.tunnelId }));
351
+ return __decorateServiceException(exception, body);
512
352
  };
513
- var serializeAws_json1_1DescribeTunnelRequest = function (input, context) {
514
- return __assign({}, (input.tunnelId != null && { tunnelId: input.tunnelId }));
353
+ const serializeAws_json1_1CloseTunnelRequest = (input, context) => {
354
+ return {
355
+ ...(input.delete != null && { delete: input.delete }),
356
+ ...(input.tunnelId != null && { tunnelId: input.tunnelId }),
357
+ };
515
358
  };
516
- var serializeAws_json1_1DestinationConfig = function (input, context) {
517
- return __assign(__assign({}, (input.services != null && { services: serializeAws_json1_1ServiceList(input.services, context) })), (input.thingName != null && { thingName: input.thingName }));
359
+ const serializeAws_json1_1DescribeTunnelRequest = (input, context) => {
360
+ return {
361
+ ...(input.tunnelId != null && { tunnelId: input.tunnelId }),
362
+ };
363
+ };
364
+ const serializeAws_json1_1DestinationConfig = (input, context) => {
365
+ return {
366
+ ...(input.services != null && { services: serializeAws_json1_1ServiceList(input.services, context) }),
367
+ ...(input.thingName != null && { thingName: input.thingName }),
368
+ };
518
369
  };
519
- var serializeAws_json1_1ListTagsForResourceRequest = function (input, context) {
520
- return __assign({}, (input.resourceArn != null && { resourceArn: input.resourceArn }));
370
+ const serializeAws_json1_1ListTagsForResourceRequest = (input, context) => {
371
+ return {
372
+ ...(input.resourceArn != null && { resourceArn: input.resourceArn }),
373
+ };
521
374
  };
522
- var serializeAws_json1_1ListTunnelsRequest = function (input, context) {
523
- return __assign(__assign(__assign({}, (input.maxResults != null && { maxResults: input.maxResults })), (input.nextToken != null && { nextToken: input.nextToken })), (input.thingName != null && { thingName: input.thingName }));
375
+ const serializeAws_json1_1ListTunnelsRequest = (input, context) => {
376
+ return {
377
+ ...(input.maxResults != null && { maxResults: input.maxResults }),
378
+ ...(input.nextToken != null && { nextToken: input.nextToken }),
379
+ ...(input.thingName != null && { thingName: input.thingName }),
380
+ };
524
381
  };
525
- var serializeAws_json1_1OpenTunnelRequest = function (input, context) {
526
- return __assign(__assign(__assign(__assign({}, (input.description != null && { description: input.description })), (input.destinationConfig != null && {
527
- destinationConfig: serializeAws_json1_1DestinationConfig(input.destinationConfig, context),
528
- })), (input.tags != null && { tags: serializeAws_json1_1TagList(input.tags, context) })), (input.timeoutConfig != null && {
529
- timeoutConfig: serializeAws_json1_1TimeoutConfig(input.timeoutConfig, context),
530
- }));
382
+ const serializeAws_json1_1OpenTunnelRequest = (input, context) => {
383
+ return {
384
+ ...(input.description != null && { description: input.description }),
385
+ ...(input.destinationConfig != null && {
386
+ destinationConfig: serializeAws_json1_1DestinationConfig(input.destinationConfig, context),
387
+ }),
388
+ ...(input.tags != null && { tags: serializeAws_json1_1TagList(input.tags, context) }),
389
+ ...(input.timeoutConfig != null && {
390
+ timeoutConfig: serializeAws_json1_1TimeoutConfig(input.timeoutConfig, context),
391
+ }),
392
+ };
531
393
  };
532
- var serializeAws_json1_1RotateTunnelAccessTokenRequest = function (input, context) {
533
- return __assign(__assign(__assign({}, (input.clientMode != null && { clientMode: input.clientMode })), (input.destinationConfig != null && {
534
- destinationConfig: serializeAws_json1_1DestinationConfig(input.destinationConfig, context),
535
- })), (input.tunnelId != null && { tunnelId: input.tunnelId }));
394
+ const serializeAws_json1_1RotateTunnelAccessTokenRequest = (input, context) => {
395
+ return {
396
+ ...(input.clientMode != null && { clientMode: input.clientMode }),
397
+ ...(input.destinationConfig != null && {
398
+ destinationConfig: serializeAws_json1_1DestinationConfig(input.destinationConfig, context),
399
+ }),
400
+ ...(input.tunnelId != null && { tunnelId: input.tunnelId }),
401
+ };
536
402
  };
537
- var serializeAws_json1_1ServiceList = function (input, context) {
403
+ const serializeAws_json1_1ServiceList = (input, context) => {
538
404
  return input
539
- .filter(function (e) { return e != null; })
540
- .map(function (entry) {
405
+ .filter((e) => e != null)
406
+ .map((entry) => {
541
407
  return entry;
542
408
  });
543
409
  };
544
- var serializeAws_json1_1Tag = function (input, context) {
545
- return __assign(__assign({}, (input.key != null && { key: input.key })), (input.value != null && { value: input.value }));
410
+ const serializeAws_json1_1Tag = (input, context) => {
411
+ return {
412
+ ...(input.key != null && { key: input.key }),
413
+ ...(input.value != null && { value: input.value }),
414
+ };
546
415
  };
547
- var serializeAws_json1_1TagKeyList = function (input, context) {
416
+ const serializeAws_json1_1TagKeyList = (input, context) => {
548
417
  return input
549
- .filter(function (e) { return e != null; })
550
- .map(function (entry) {
418
+ .filter((e) => e != null)
419
+ .map((entry) => {
551
420
  return entry;
552
421
  });
553
422
  };
554
- var serializeAws_json1_1TagList = function (input, context) {
423
+ const serializeAws_json1_1TagList = (input, context) => {
555
424
  return input
556
- .filter(function (e) { return e != null; })
557
- .map(function (entry) {
425
+ .filter((e) => e != null)
426
+ .map((entry) => {
558
427
  return serializeAws_json1_1Tag(entry, context);
559
428
  });
560
429
  };
561
- var serializeAws_json1_1TagResourceRequest = function (input, context) {
562
- return __assign(__assign({}, (input.resourceArn != null && { resourceArn: input.resourceArn })), (input.tags != null && { tags: serializeAws_json1_1TagList(input.tags, context) }));
430
+ const serializeAws_json1_1TagResourceRequest = (input, context) => {
431
+ return {
432
+ ...(input.resourceArn != null && { resourceArn: input.resourceArn }),
433
+ ...(input.tags != null && { tags: serializeAws_json1_1TagList(input.tags, context) }),
434
+ };
563
435
  };
564
- var serializeAws_json1_1TimeoutConfig = function (input, context) {
565
- return __assign({}, (input.maxLifetimeTimeoutMinutes != null && { maxLifetimeTimeoutMinutes: input.maxLifetimeTimeoutMinutes }));
436
+ const serializeAws_json1_1TimeoutConfig = (input, context) => {
437
+ return {
438
+ ...(input.maxLifetimeTimeoutMinutes != null && { maxLifetimeTimeoutMinutes: input.maxLifetimeTimeoutMinutes }),
439
+ };
566
440
  };
567
- var serializeAws_json1_1UntagResourceRequest = function (input, context) {
568
- return __assign(__assign({}, (input.resourceArn != null && { resourceArn: input.resourceArn })), (input.tagKeys != null && { tagKeys: serializeAws_json1_1TagKeyList(input.tagKeys, context) }));
441
+ const serializeAws_json1_1UntagResourceRequest = (input, context) => {
442
+ return {
443
+ ...(input.resourceArn != null && { resourceArn: input.resourceArn }),
444
+ ...(input.tagKeys != null && { tagKeys: serializeAws_json1_1TagKeyList(input.tagKeys, context) }),
445
+ };
569
446
  };
570
- var deserializeAws_json1_1CloseTunnelResponse = function (output, context) {
447
+ const deserializeAws_json1_1CloseTunnelResponse = (output, context) => {
571
448
  return {};
572
449
  };
573
- var deserializeAws_json1_1ConnectionState = function (output, context) {
450
+ const deserializeAws_json1_1ConnectionState = (output, context) => {
574
451
  return {
575
452
  lastUpdatedAt: output.lastUpdatedAt != null
576
453
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdatedAt)))
@@ -578,28 +455,28 @@ var deserializeAws_json1_1ConnectionState = function (output, context) {
578
455
  status: __expectString(output.status),
579
456
  };
580
457
  };
581
- var deserializeAws_json1_1DescribeTunnelResponse = function (output, context) {
458
+ const deserializeAws_json1_1DescribeTunnelResponse = (output, context) => {
582
459
  return {
583
460
  tunnel: output.tunnel != null ? deserializeAws_json1_1Tunnel(output.tunnel, context) : undefined,
584
461
  };
585
462
  };
586
- var deserializeAws_json1_1DestinationConfig = function (output, context) {
463
+ const deserializeAws_json1_1DestinationConfig = (output, context) => {
587
464
  return {
588
465
  services: output.services != null ? deserializeAws_json1_1ServiceList(output.services, context) : undefined,
589
466
  thingName: __expectString(output.thingName),
590
467
  };
591
468
  };
592
- var deserializeAws_json1_1LimitExceededException = function (output, context) {
469
+ const deserializeAws_json1_1LimitExceededException = (output, context) => {
593
470
  return {
594
471
  message: __expectString(output.message),
595
472
  };
596
473
  };
597
- var deserializeAws_json1_1ListTagsForResourceResponse = function (output, context) {
474
+ const deserializeAws_json1_1ListTagsForResourceResponse = (output, context) => {
598
475
  return {
599
476
  tags: output.tags != null ? deserializeAws_json1_1TagList(output.tags, context) : undefined,
600
477
  };
601
478
  };
602
- var deserializeAws_json1_1ListTunnelsResponse = function (output, context) {
479
+ const deserializeAws_json1_1ListTunnelsResponse = (output, context) => {
603
480
  return {
604
481
  nextToken: __expectString(output.nextToken),
605
482
  tunnelSummaries: output.tunnelSummaries != null
@@ -607,7 +484,7 @@ var deserializeAws_json1_1ListTunnelsResponse = function (output, context) {
607
484
  : undefined,
608
485
  };
609
486
  };
610
- var deserializeAws_json1_1OpenTunnelResponse = function (output, context) {
487
+ const deserializeAws_json1_1OpenTunnelResponse = (output, context) => {
611
488
  return {
612
489
  destinationAccessToken: __expectString(output.destinationAccessToken),
613
490
  sourceAccessToken: __expectString(output.sourceAccessToken),
@@ -615,22 +492,22 @@ var deserializeAws_json1_1OpenTunnelResponse = function (output, context) {
615
492
  tunnelId: __expectString(output.tunnelId),
616
493
  };
617
494
  };
618
- var deserializeAws_json1_1ResourceNotFoundException = function (output, context) {
495
+ const deserializeAws_json1_1ResourceNotFoundException = (output, context) => {
619
496
  return {
620
497
  message: __expectString(output.message),
621
498
  };
622
499
  };
623
- var deserializeAws_json1_1RotateTunnelAccessTokenResponse = function (output, context) {
500
+ const deserializeAws_json1_1RotateTunnelAccessTokenResponse = (output, context) => {
624
501
  return {
625
502
  destinationAccessToken: __expectString(output.destinationAccessToken),
626
503
  sourceAccessToken: __expectString(output.sourceAccessToken),
627
504
  tunnelArn: __expectString(output.tunnelArn),
628
505
  };
629
506
  };
630
- var deserializeAws_json1_1ServiceList = function (output, context) {
631
- var retVal = (output || [])
632
- .filter(function (e) { return e != null; })
633
- .map(function (entry) {
507
+ const deserializeAws_json1_1ServiceList = (output, context) => {
508
+ const retVal = (output || [])
509
+ .filter((e) => e != null)
510
+ .map((entry) => {
634
511
  if (entry === null) {
635
512
  return null;
636
513
  }
@@ -638,16 +515,16 @@ var deserializeAws_json1_1ServiceList = function (output, context) {
638
515
  });
639
516
  return retVal;
640
517
  };
641
- var deserializeAws_json1_1Tag = function (output, context) {
518
+ const deserializeAws_json1_1Tag = (output, context) => {
642
519
  return {
643
520
  key: __expectString(output.key),
644
521
  value: __expectString(output.value),
645
522
  };
646
523
  };
647
- var deserializeAws_json1_1TagList = function (output, context) {
648
- var retVal = (output || [])
649
- .filter(function (e) { return e != null; })
650
- .map(function (entry) {
524
+ const deserializeAws_json1_1TagList = (output, context) => {
525
+ const retVal = (output || [])
526
+ .filter((e) => e != null)
527
+ .map((entry) => {
651
528
  if (entry === null) {
652
529
  return null;
653
530
  }
@@ -655,15 +532,15 @@ var deserializeAws_json1_1TagList = function (output, context) {
655
532
  });
656
533
  return retVal;
657
534
  };
658
- var deserializeAws_json1_1TagResourceResponse = function (output, context) {
535
+ const deserializeAws_json1_1TagResourceResponse = (output, context) => {
659
536
  return {};
660
537
  };
661
- var deserializeAws_json1_1TimeoutConfig = function (output, context) {
538
+ const deserializeAws_json1_1TimeoutConfig = (output, context) => {
662
539
  return {
663
540
  maxLifetimeTimeoutMinutes: __expectInt32(output.maxLifetimeTimeoutMinutes),
664
541
  };
665
542
  };
666
- var deserializeAws_json1_1Tunnel = function (output, context) {
543
+ const deserializeAws_json1_1Tunnel = (output, context) => {
667
544
  return {
668
545
  createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
669
546
  description: __expectString(output.description),
@@ -686,7 +563,7 @@ var deserializeAws_json1_1Tunnel = function (output, context) {
686
563
  tunnelId: __expectString(output.tunnelId),
687
564
  };
688
565
  };
689
- var deserializeAws_json1_1TunnelSummary = function (output, context) {
566
+ const deserializeAws_json1_1TunnelSummary = (output, context) => {
690
567
  return {
691
568
  createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
692
569
  description: __expectString(output.description),
@@ -698,10 +575,10 @@ var deserializeAws_json1_1TunnelSummary = function (output, context) {
698
575
  tunnelId: __expectString(output.tunnelId),
699
576
  };
700
577
  };
701
- var deserializeAws_json1_1TunnelSummaryList = function (output, context) {
702
- var retVal = (output || [])
703
- .filter(function (e) { return e != null; })
704
- .map(function (entry) {
578
+ const deserializeAws_json1_1TunnelSummaryList = (output, context) => {
579
+ const retVal = (output || [])
580
+ .filter((e) => e != null)
581
+ .map((entry) => {
705
582
  if (entry === null) {
706
583
  return null;
707
584
  }
@@ -709,65 +586,55 @@ var deserializeAws_json1_1TunnelSummaryList = function (output, context) {
709
586
  });
710
587
  return retVal;
711
588
  };
712
- var deserializeAws_json1_1UntagResourceResponse = function (output, context) {
589
+ const deserializeAws_json1_1UntagResourceResponse = (output, context) => {
713
590
  return {};
714
591
  };
715
- var deserializeMetadata = function (output) {
716
- var _a;
717
- return ({
718
- httpStatusCode: output.statusCode,
719
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
720
- extendedRequestId: output.headers["x-amz-id-2"],
721
- cfId: output.headers["x-amz-cf-id"],
722
- });
723
- };
724
- var collectBody = function (streamBody, context) {
725
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
592
+ const deserializeMetadata = (output) => ({
593
+ httpStatusCode: output.statusCode,
594
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
595
+ extendedRequestId: output.headers["x-amz-id-2"],
596
+ cfId: output.headers["x-amz-cf-id"],
597
+ });
598
+ const collectBody = (streamBody = new Uint8Array(), context) => {
726
599
  if (streamBody instanceof Uint8Array) {
727
600
  return Promise.resolve(streamBody);
728
601
  }
729
602
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
730
603
  };
731
- var collectBodyString = function (streamBody, context) {
732
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
733
- };
734
- var buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {
735
- var _a, hostname, _b, protocol, port, basePath, contents;
736
- return __generator(this, function (_c) {
737
- switch (_c.label) {
738
- case 0: return [4, context.endpoint()];
739
- case 1:
740
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
741
- contents = {
742
- protocol: protocol,
743
- hostname: hostname,
744
- port: port,
745
- method: "POST",
746
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
747
- headers: headers,
748
- };
749
- if (resolvedHostname !== undefined) {
750
- contents.hostname = resolvedHostname;
751
- }
752
- if (body !== undefined) {
753
- contents.body = body;
754
- }
755
- return [2, new __HttpRequest(contents)];
756
- }
757
- });
758
- }); };
759
- var parseBody = function (streamBody, context) {
760
- return collectBodyString(streamBody, context).then(function (encoded) {
761
- if (encoded.length) {
762
- return JSON.parse(encoded);
763
- }
764
- return {};
765
- });
604
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
605
+ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
606
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
607
+ const contents = {
608
+ protocol,
609
+ hostname,
610
+ port,
611
+ method: "POST",
612
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
613
+ headers,
614
+ };
615
+ if (resolvedHostname !== undefined) {
616
+ contents.hostname = resolvedHostname;
617
+ }
618
+ if (body !== undefined) {
619
+ contents.body = body;
620
+ }
621
+ return new __HttpRequest(contents);
766
622
  };
767
- var loadRestJsonErrorCode = function (output, data) {
768
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
769
- var sanitizeErrorCode = function (rawValue) {
770
- var cleanValue = rawValue;
623
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
624
+ if (encoded.length) {
625
+ return JSON.parse(encoded);
626
+ }
627
+ return {};
628
+ });
629
+ const parseErrorBody = async (errorBody, context) => {
630
+ const value = await parseBody(errorBody, context);
631
+ value.message = value.message ?? value.Message;
632
+ return value;
633
+ };
634
+ const loadRestJsonErrorCode = (output, data) => {
635
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
636
+ const sanitizeErrorCode = (rawValue) => {
637
+ let cleanValue = rawValue;
771
638
  if (typeof cleanValue === "number") {
772
639
  cleanValue = cleanValue.toString();
773
640
  }
@@ -782,7 +649,7 @@ var loadRestJsonErrorCode = function (output, data) {
782
649
  }
783
650
  return cleanValue;
784
651
  };
785
- var headerKey = findKey(output.headers, "x-amzn-errortype");
652
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
786
653
  if (headerKey !== undefined) {
787
654
  return sanitizeErrorCode(output.headers[headerKey]);
788
655
  }